Skip to content

Commit

Permalink
Update browser and nav bar title on language change (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda authored Mar 28, 2023
1 parent 92506cc commit b1dc13c
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/screens/DownloadQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const DownloadQueue: React.FC = () => {
useEffect(() => {
setTitle(t('download.queue.title'));
setAction(null);
}, []);
}, [t]);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const onDragEnd = (result: DropResult) => {};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Extensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function MangaExtensions() {
<LangSelect shownLangs={shownLangs} setShownLangs={setShownLangs} allLangs={allLangs} />
</>,
);
}, [shownLangs]);
}, [t, shownLangs]);

const { data: allExtensions, mutate, loading } = useQuery<IExtension[]>('/api/v1/extension/list');

Expand Down
2 changes: 1 addition & 1 deletion src/screens/Library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function Library() {
setTitle('');
setAction(null);
};
}, []);
}, [t]);

const handleTabChange = (newTab: number) => {
setTabSearchParam(newTab === 0 ? undefined : newTab);
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Manga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Manga: React.FC = () => {

useEffect(() => {
setTitle(manga?.title ?? t('manga.title'));
}, [manga?.title]);
}, [t, manga?.title]);

if (error && !manga) {
return <EmptyView message={t('manga.error.label.request_failure')} messageExtra={error.message ?? error} />;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function Reader() {
} else {
setTitle(`${manga.title}: ${(chapter as IChapter).name}`);
}
}, [manga, chapter]);
}, [t, manga, chapter]);

useEffect(() => {
if (!areDefaultSettingsLoading && !isMangaLoading) {
Expand Down
4 changes: 2 additions & 2 deletions src/screens/SearchAll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const SearchAll: React.FC = () => {
useEffect(() => {
setTitle(t('search.title.global_search'));
setAction(<AppbarSearch />);
}, []);
}, [t]);

useEffect(() => {
client
Expand Down Expand Up @@ -161,7 +161,7 @@ const SearchAll: React.FC = () => {
/>
</>,
);
}, [shownLangs, sources]);
}, [t, shownLangs, sources]);

if (query) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function Settings() {
useEffect(() => {
setTitle(t('settings.title'));
setAction(null);
}, []);
}, [t]);

const { darkTheme, setDarkTheme } = useContext(DarkTheme);
const [serverAddress, setServerAddress] = useLocalStorage<String>('serverBaseURL', '');
Expand Down
2 changes: 1 addition & 1 deletion src/screens/SourceConfigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function SourceConfigure() {
useEffect(() => {
setTitle(t('source.configuration.title'));
setAction(null);
}, []);
}, [t]);

const { sourceId } = useParams<{ sourceId: string }>();
const { data: sourcePreferences = [], mutate } = useQuery<SourcePreferences[]>(
Expand Down
2 changes: 1 addition & 1 deletion src/screens/SourceMangas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function SourceMangas({ popular }: { popular: boolean }) {

useEffect(() => {
setTitle(t('source.title')); // title is later set after a fetch but we set it here once
}, []);
}, [t]);

useEffect(() => {
client
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function Sources() {
/>
</>,
);
}, [shownLangs, sources]);
}, [t, shownLangs, sources]);

if (loading) return <LoadingPlaceholder />;

Expand Down
2 changes: 1 addition & 1 deletion src/screens/Updates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Updates: React.FC = () => {
setTitle(t('updates.title'));

setAction(null);
}, []);
}, [t]);

useEffect(() => {
if (hasNextPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function About() {
useEffect(() => {
setTitle(t('settings.about.title'));
setAction(null);
}, []);
}, [t]);

const { data: about } = useQuery<IAbout>('/api/v1/settings/about');

Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/Backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Backup() {
useEffect(() => {
setTitle(t('settings.backup.title'));
setAction(null);
}, []);
}, [t]);

const { baseURL } = client.defaults;

Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/Categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Categories() {
useEffect(() => {
setTitle(t('category.title.categories'));
setAction(null);
}, []);
}, [t]);

const { data, mutate } = useQuery<ICategory[]>('/api/v1/category/');
const categories = useMemo(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/DefaultReaderSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function DefaultReaderSettings() {
useEffect(() => {
setTitle(t('reader.settings.title.default_reader_settings'));
setAction(null);
}, []);
}, [t]);

const { metadata, settings, loading } = useDefaultReaderSettings();

Expand Down

0 comments on commit b1dc13c

Please sign in to comment.