Skip to content

Commit

Permalink
fix: respect the system's language settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso committed Dec 9, 2024
1 parent 3f560ac commit 7e31034
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
10 changes: 9 additions & 1 deletion src/components/connections/ConnectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
InformationCircleIcon,
XMarkIcon,
} from '@heroicons/vue/24/outline'
import { first, last } from 'lodash'
import { twMerge } from 'tailwind-merge'
import { defineComponent } from 'vue'

Expand Down Expand Up @@ -71,9 +72,16 @@ export default defineComponent<{
</button>
</div>
)

const connChians = props.conn.chains
const fisrtChain = first(connChians)
const lastChain = last(connChians)
const chians = (
<span class="inline w-56 truncate text-sm">
{[...props.conn.chains].reverse().join('->')}
<span class="hidden sm:inline">{[...connChians].reverse().join('->')}</span>
<span class="inline sm:hidden">
{connChians.length > 1 ? [lastChain, fisrtChain].join(' =>> ') : fisrtChain}
</span>
</span>
)
const rule = <span class="hidden text-sm tracking-tight xl:inline">{props.conn.rule}</span>
Expand Down
7 changes: 6 additions & 1 deletion src/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { useStorage } from '@vueuse/core'

// global
export const theme = useStorage<string>('config/theme', 'default')
export const language = useStorage<LANG>('config/language', LANG.EN_US)
export const language = useStorage<LANG>(
'config/language',
Object.values(LANG).includes(navigator.language as LANG)
? (navigator.language as LANG)
: LANG.EN_US,
)
export const isSiderbarCollapsed = useStorage('config/is-sidebar-collapsed', true)
export const font = useStorage<FONTS>('config/font', FONTS.MI_SANS)

Expand Down
2 changes: 1 addition & 1 deletion src/views/ConnectionsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ $t('noContent') }}
</div>
</template>
<div class="flex flex-col gap-[2px]">
<div class="flex flex-col gap-1">
<ConnectionCard
v-for="conn in renderConnections"
:key="conn.id"
Expand Down
2 changes: 1 addition & 1 deletion src/views/SetupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if (query.has('hostname')) {
? 'https'
: window.location.protocol.replace(':', ''),
host: query.get('hostname') as string,
port: Number(query.get('port')) as unknown as number,
port: Number(query.get('port')),
password: query.get('secret') as string,
})
} else {
Expand Down
9 changes: 2 additions & 7 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ export default {
},
extend: {
colors: {
['low-latency']: 'rgb(181,196,177)',
['medium-latency']: 'rgb(224, 200, 166)',
['high-latency']: '#C68A8A',
},
backgroundColors: {
['low-latency']: 'rgb(181,196,177)',
['medium-latency']: 'rgb(224, 200, 166)',
['low-latency']: 'rgb(181,216,177)',
['medium-latency']: 'rgb(244, 210, 166)',
['high-latency']: '#C68A8A',
},
fontFamily: {
Expand Down

0 comments on commit 7e31034

Please sign in to comment.