refactor: beta 6 (#395)

Few small fixes and refactors from beta 6 feedback

* style: presentation tweaks

* fix: prevent calling undefined

* fix: fullscreen toggle in safari

* refactor: convert to typescript and simplify
This commit is contained in:
Carlos Valente
2023-05-19 22:19:36 +02:00
committed by GitHub
parent 96a11ccff8
commit 8bf223dee6
4 changed files with 84 additions and 51 deletions
@@ -30,7 +30,7 @@ export const TranslationProvider = ({ children }: PropsWithChildren) => {
const { data } = useSettings();
const getLocalizedString = useCallback(
(key: keyof typeof langEn, lang = data!.language): string => {
(key: keyof typeof langEn, lang = data?.language || 'en'): string => {
if (lang in translationsList) {
if (key in translationsList[lang as keyof typeof translationsList]) {
return translationsList[lang as keyof typeof translationsList][key];
@@ -38,7 +38,7 @@ export const TranslationProvider = ({ children }: PropsWithChildren) => {
}
return langEn[key];
},
[data],
[data?.language],
);
const contextValue = {