Skip to content

Commit

Permalink
Rename "ExtensionSettings" to "BrowseSettings" (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda authored Feb 16, 2024
1 parent e383cc9 commit 4b54b09
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { DownloadSettings } from '@/screens/settings/DownloadSettings.tsx';
import { ServerSettings } from '@/screens/settings/ServerSettings.tsx';
import { ServerUpdateChecker } from '@/components/settings/ServerUpdateChecker.tsx';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { ExtensionSettings } from '@/screens/settings/ExtensionSettings.tsx';
import { BrowseSettings } from '@/screens/settings/BrowseSettings.tsx';
import { WebUISettings } from '@/screens/settings/WebUISettings.tsx';
import { Migrate } from '@/screens/Migrate.tsx';

Expand Down Expand Up @@ -101,7 +101,7 @@ export const App: React.FC = () => (
<Route path="backup" element={<Backup />} />
<Route path="server" element={<ServerSettings />} />
<Route path="webUI" element={<WebUISettings />} />
<Route path="extensionSettings" element={<ExtensionSettings />} />
<Route path="browseSettings" element={<BrowseSettings />} />
</Route>

{/* Manga Routes */}
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@
"title": "Extension repositories"
}
}
},
"title": "Extension Settings"
}
},
"state": {
"label": {
Expand Down Expand Up @@ -684,6 +683,9 @@
}
},
"settings": {
"browse": {
"title": "Browse settings"
},
"about": {
"server": {
"label": {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Extensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export function Extensions() {
{FileInputComponent}
<Stack sx={{ paddingTop: '20px' }} alignItems="center" justifyContent="center" rowGap="10px">
<Typography>{t('extension.label.add_repository_info')}</Typography>
<Button component={Link} variant="contained" to="/settings/extensionSettings">
<Button component={Link} variant="contained" to="/browse/extensionSettings">
{t('settings.title')}
</Button>
</Stack>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function Settings() {
secondary={t('settings.clear_cache.label.description')}
/>
</ListItemButton>
<ListItemLink to="/settings/extensionSettings">
<ListItemLink to="/settings/browseSettings">
<ListItemIcon>
<ExploreOutlinedIcon />
</ListItemIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ import { useLocalStorage } from '@/util/useLocalStorage.tsx';

type ExtensionsSettings = Pick<GqlServerSettings, 'maxSourcesInParallel' | 'localSourcePath' | 'extensionRepos'>;

const extractExtensionSettings = (settings: GqlServerSettings): ExtensionsSettings => ({
const extractBrowseSettings = (settings: GqlServerSettings): ExtensionsSettings => ({
maxSourcesInParallel: settings.maxSourcesInParallel,
localSourcePath: settings.localSourcePath,
extensionRepos: settings.extensionRepos,
});

export const ExtensionSettings = () => {
export const BrowseSettings = () => {
const { t } = useTranslation();
const { setTitle, setAction } = useContext(NavBarContext);

useSetDefaultBackTo('settings');

useEffect(() => {
setTitle(t('extension.settings.title'));
setTitle(t('settings.browse.title'));
setAction(null);
}, [t]);

const [showNsfw, setShowNsfw] = useLocalStorage<boolean>('showNsfw', true);

const { data } = requestManager.useGetServerSettings();
const serverSettings = data ? extractExtensionSettings(data.settings) : undefined;
const serverSettings = data ? extractBrowseSettings(data.settings) : undefined;
const [mutateSettings] = requestManager.useUpdateServerSettings();

const updateSetting = <Setting extends keyof ExtensionsSettings>(
Expand Down

0 comments on commit 4b54b09

Please sign in to comment.