aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/translations/index.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-28 08:04:46 -0800
committerAdam Soltys <[email protected]>2024-11-28 08:04:46 -0800
commit380da842ffdb597eebb88f217f89a9268cbfaf6a (patch)
tree1cf3067d057a8d6c1be3bb89f96ee9deaa8ab05d /src/lib/translations/index.js
parentc1098927eddb6c9c5beac8420e5cf48edc526731 (diff)
downloadcoinos-ui-380da842ffdb597eebb88f217f89a9268cbfaf6a.tar.gz
coinos-ui-380da842ffdb597eebb88f217f89a9268cbfaf6a.zip
currency locale
Diffstat (limited to 'src/lib/translations/index.js')
0 files changed, 0 insertions, 0 deletions
4 ^
4aa1ad89 ^
8acc59a8 ^

a038ce97 ^
8acc59a8 ^
dd4f645b ^
d99a3524 ^
eb9a9c04 ^
a038ce97 ^
d99a3524 ^
8acc59a8 ^
7f614fb4 ^
8acc59a8 ^
6af45235 ^







8acc59a8 ^
62fdcb0c ^

d99a3524 ^
62fdcb0c ^
05f5001f ^
8acc59a8 ^





09f5730f

eb19aede ^
27cbd543 ^
8acc59a8 ^
dd4f645b ^

8acc59a8 ^
27cbd543 ^






1281f173 ^
27cbd543 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
        
                                                             
                     
                                                  
                      
                                         
                                              

                                                    
                                           
                                               
                                              
                                                              
 
                                               
 
                          
 
                       







                                                                        
                                                                               

                                               
                                                                       
                         
                                                                             





                                     

         
                          
                                                                       
                

                         
     






                                                        
                                           

         
<script>
	import { SvelteToast } from '@zerodevx/svelte-toast';
  import '$lib/i18n';
  import { isLoading, locale } from 'svelte-i18n';
  import '../app.css';
	import { onMount } from 'svelte';
	import { connect } from '$lib/socket';
	import { user, token } from '$lib/store';
	import { page, session } from '$app/stores';
	import { browser } from '$app/env';
	import { goto } from '$app/navigation';
	import { LoadingSplash } from '$comp';
	import { warning, protectedRoutes } from '$lib/utils';

	browser && ($token ||= $session.token);

	let ready = false;

	onMount(() => {
    // get locale from local storage
    let localStorageLocale = localStorage.getItem('svelte-i18n-locale');
    if (localStorageLocale) locale.set(localStorageLocale);

    locale.subscribe((lng) => {
      if (lng) localStorage.setItem('svelte-i18n-locale', lng);
    });

		if (protectedRoutes.find((p) => $page.url.pathname.match(p))) {
			if (!$token) {
				goto('/login');
				warning('Please sign in to continue.');
			}
			user.subscribe((u) => u?.username && (ready = true));
		} else {
			ready = true;
		}

		connect();
	});
</script>

{#if ready && !$isLoading}
	<SvelteToast options={{ reversed: true, intro: { y: 192 } }} />
	<slot />
{:else}
	<LoadingSplash />
{/if}

<style>
	:root {
		--toastContainerTop: auto;
		--toastContainerRight: auto;
		--toastContainerBottom: 8rem;
		--toastContainerLeft: calc(50vw - 8rem);
		--toastBackground: #292929;
	}
</style>