-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8919617
commit 7357fa4
Showing
13 changed files
with
737 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,39 @@ | ||
<script setup lang="ts"> | ||
import { get } from '@vueuse/core'; | ||
import type { Country } from '~/composables/countries'; | ||
const props = withDefaults( | ||
withDefaults( | ||
defineProps<{ | ||
modelValue: string; | ||
disabled?: boolean; | ||
}>(), | ||
{ | ||
disabled: false, | ||
}, | ||
); | ||
const emit = defineEmits<{ | ||
(e: 'update:modelValue', value: string): void; | ||
}>(); | ||
const { modelValue } = toRefs(props); | ||
const { t } = useI18n(); | ||
const { countries } = useCountries(); | ||
const country = computed({ | ||
get() { | ||
return get(countries).find(({ code }) => code === get(modelValue)) || null; | ||
}, | ||
set(item: Country | null) { | ||
emit('update:modelValue', item ? item.code : ''); | ||
}, | ||
}); | ||
const modelValue = defineModel<string>({ required: true }); | ||
</script> | ||
|
||
<template> | ||
<RuiAutoComplete | ||
id="country" | ||
v-model="country" | ||
v-model="modelValue" | ||
variant="outlined" | ||
color="primary" | ||
autocomplete="country" | ||
:data="countries" | ||
:options="countries" | ||
:disabled="disabled" | ||
key-prop="code" | ||
text-prop="name" | ||
key-attr="code" | ||
text-attr="name" | ||
:label="t('auth.signup.address.form.country')" | ||
:item-height="46" | ||
:no-data-text="t('country_select.no_data')" | ||
> | ||
<template #no-data> | ||
{{ t('country_select.no_data') }} | ||
</template> | ||
<template #default="{ item }"> | ||
{{ item.name }} | ||
<template #item="{ item }"> | ||
<div class="py-2"> | ||
{{ item.name }} | ||
</div> | ||
</template> | ||
</RuiAutoComplete> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<script setup lang="ts"> | ||
import { get } from '@vueuse/core'; | ||
import LocalIntegrationData from '~/public/integrations/all.json'; | ||
enum TabCategory { | ||
ALL = 'all', | ||
BLOCKCHAINS = 'blockchains', | ||
EXCHANGES = 'exchanges', | ||
PROTOCOLS = 'protocols', | ||
} | ||
const search: Ref<string> = ref(''); | ||
const searchDebounced = refDebounced(search, 200); | ||
const tab: Ref<TabCategory> = ref(TabCategory.ALL); | ||
const { t } = useI18n(); | ||
const tabCategoriesLabel = computed(() => ({ | ||
[TabCategory.ALL]: t('integration.tabs.all'), | ||
[TabCategory.BLOCKCHAINS]: t('integration.blockchains.title'), | ||
[TabCategory.EXCHANGES]: t('integration.exchanges.title'), | ||
[TabCategory.PROTOCOLS]: t('integration.protocols.title'), | ||
})); | ||
const data = computed(() => { | ||
const searchVal = get(searchDebounced); | ||
const filter = (data: { label: string; image: string }[]) => data.filter(item => item.label.toLocaleLowerCase().trim().includes(searchVal.toLocaleLowerCase().trim())); | ||
const integrationData = LocalIntegrationData; | ||
return { | ||
[TabCategory.BLOCKCHAINS]: { | ||
title: t('integration.blockchains.title'), | ||
description: t('integration.blockchains.description'), | ||
data: filter(integrationData.blockchains), | ||
}, | ||
[TabCategory.EXCHANGES]: { | ||
title: t('integration.exchanges.title'), | ||
description: t('integration.exchanges.description'), | ||
data: filter(integrationData.exchanges), | ||
}, | ||
[TabCategory.PROTOCOLS]: { | ||
title: t('integration.protocols.title'), | ||
description: t('integration.protocols.description', { number: Math.floor(integrationData.protocols.length / 10) * 10 }), | ||
data: filter(integrationData.protocols), | ||
}, | ||
}; | ||
}); | ||
const isAllSelected: ComputedRef<boolean> = computed(() => get(tab) === 'all'); | ||
const total: ComputedRef<number> = computed(() => Object.values(get(data)).reduce((accumulator, item) => accumulator + item.data.length, 0)); | ||
const [DefineNotFound, ReuseNotFound] = createReusableTemplate<{ | ||
keyword: string; | ||
}>(); | ||
const { isMdAndUp } = useBreakpoint(); | ||
</script> | ||
|
||
<template> | ||
<DefineNotFound | ||
#default="{ keyword }" | ||
class="text-rui-text-secondary" | ||
> | ||
{{ t('integration.no_data_found', { keyword }) }} | ||
</DefineNotFound> | ||
<div class="py-10 md:py-20"> | ||
<div class="container flex flex-col md:flex-row items-start gap-10 lg:gap-16"> | ||
<div class="md:sticky md:top-20 w-full md:w-[18rem]"> | ||
<RuiTextField | ||
v-model="search" | ||
variant="outlined" | ||
:label="t('integration.search')" | ||
prepend-icon="search-line" | ||
color="primary" | ||
clearable | ||
/> | ||
<RuiDivider class="mb-4" /> | ||
<ClientOnly> | ||
<RuiTabs | ||
v-model="tab" | ||
color="primary" | ||
:vertical="isMdAndUp" | ||
grow | ||
> | ||
<RuiTab | ||
v-for="(item, key) in tabCategoriesLabel" | ||
:key="key" | ||
:align="isMdAndUp ? 'start' : 'center'" | ||
class="rounded cursor-pointer" | ||
active-class="!bg-rui-primary [&:after]:hidden !text-white" | ||
:tab-value="key" | ||
> | ||
{{ item }} | ||
</RuiTab> | ||
</RuiTabs> | ||
</ClientOnly> | ||
</div> | ||
<TransitionGroup | ||
tag="div" | ||
enter-active-class="transition" | ||
leave-active-class="transition h-0 overflow-hidden absolute" | ||
enter-from-class="opacity-0 transform -translate-y-10" | ||
leave-to-class="opacity-0" | ||
class="flex-1 flex flex-col gap-10" | ||
> | ||
<ReuseNotFound | ||
v-if="isAllSelected && total === 0" | ||
:keyword="searchDebounced" | ||
/> | ||
<template | ||
v-for="(datum, key) in data" | ||
v-else | ||
:key="key" | ||
> | ||
<div | ||
v-if="(isAllSelected && datum.data.length > 0) || tab === key" | ||
class="flex flex-col gap-10" | ||
> | ||
<div class="flex flex-col gap-4"> | ||
<div class="text-h4"> | ||
{{ datum.title }} | ||
</div> | ||
<div class="text-rui-text-secondary text-body-1"> | ||
{{ datum.description }} | ||
</div> | ||
</div> | ||
<ReuseNotFound | ||
v-if="datum.data.length === 0" | ||
:keyword="searchDebounced" | ||
/> | ||
<TransitionGroup | ||
v-else | ||
tag="div" | ||
move-class="transition-all" | ||
enter-active-class="transition-all" | ||
leave-active-class="transition-all absolute" | ||
enter-from-class="opacity-0" | ||
leave-to-class="opacity-0" | ||
class="flex flex-wrap gap-4" | ||
> | ||
<template | ||
v-for="item in datum.data" | ||
:key="item.label" | ||
> | ||
<RuiTooltip :open-delay="200"> | ||
<template #activator> | ||
<div class="w-14 h-14 border border-rui-grey-300 rounded p-2.5"> | ||
<img | ||
class="w-full h-full" | ||
:src="item.image" | ||
:alt="item.label" | ||
/> | ||
</div> | ||
</template> | ||
{{ item.label }} | ||
</RuiTooltip> | ||
</template> | ||
</TransitionGroup> | ||
</div> | ||
</template> | ||
</TransitionGroup> | ||
</div> | ||
</div> | ||
</template> |
Oops, something went wrong.