Skip to content

Commit

Permalink
Reduce pageload flicker by adding backup font and moving locale initi…
Browse files Browse the repository at this point in the history
…alization
  • Loading branch information
StevenWeathers committed Apr 7, 2024
1 parent 68b45c9 commit f3954cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import '../node_modules/quill/dist/quill.core.css';
import '../node_modules/quill/dist/quill.snow.css';
import Navaid from 'navaid';
import { onDestroy, onMount } from 'svelte';
import { onDestroy } from 'svelte';
import { AppConfig, appRoutes } from './config';
import apiclient from './apiclient';
Expand Down Expand Up @@ -52,12 +52,12 @@
import AdminSubscription from './pages/admin/Subscription.svelte';
import { setLocale } from './i18n/i18n-svelte';
import { detectLocale } from './i18n/i18n-util';
import { loadLocaleAsync } from './i18n/i18n-util.async';
import Confirmation from './pages/subscription/Confirmation.svelte';
import Pricing from './pages/subscription/Pricing.svelte';
import PrivacyPolicy from './pages/support/PrivacyPolicy.svelte';
import TermsConditions from './pages/support/TermsConditions.svelte';
import Support from './pages/support/Support.svelte';
import { loadLocale } from './i18n/i18n-util.sync';
const {
FeaturePoker,
Expand All @@ -73,6 +73,10 @@
activeWarrior = w;
});
const detectedLocale = activeWarrior.locale || detectLocale();
loadLocale(detectedLocale);
setLocale(detectedLocale);
$: if (document.dir !== $dir) {
document.dir = $dir;
}
Expand Down Expand Up @@ -529,12 +533,6 @@
});
}
onMount(async () => {
const detectedLocale = activeWarrior.locale || detectLocale();
await loadLocaleAsync(detectedLocale);
setLocale(detectedLocale);
});
onDestroy(router.unlisten);
</script>

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import 'tailwindcss/utilities';

.font-rajdhani {
font-family: 'Rajdhani', sans-serif;
font-family: 'Rajdhani', 'Arial Narrow', sans-serif;
}

::-webkit-calendar-picker-indicator {
Expand Down

0 comments on commit f3954cc

Please sign in to comment.