-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
3d27565
commit 28facd6
Showing
9 changed files
with
171 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<div class="flex flex-col gap-4"> | ||
<div class="grid grid-cols-[1fr,auto,auto] gap-4 items-baseline"> | ||
<h2 class="text-xl font-bold">{{ name }}</h2> | ||
<!-- <Button theme="primary"> | ||
<Icon icon="tabler:upload" /> | ||
<span class="hidden md:block">New</span> | ||
</Button> --> | ||
<Button theme="outline"> | ||
<Icon icon="tabler:chevron-up" class="duration-100" :style="{ | ||
transform: collapsed ? 'rotate(180deg)' : 'rotate(0deg)', | ||
}" @click="collapsed = !collapsed" /> | ||
</Button> | ||
</div> | ||
<div ref="container" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 overflow-hidden duration-200"> | ||
<GridItem v-for="emoji in emojis" :key="emoji.id" :emoji="emoji" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { Emoji } from "@versia/client/types"; | ||
import Button from "~/packages/ui/components/buttons/button.vue"; | ||
import Icon from "~/packages/ui/components/icons/icon.vue"; | ||
import GridItem from "./grid-item.vue"; | ||
defineProps<{ | ||
emojis: (Emoji & { id: string; global: boolean })[]; | ||
name: string; | ||
}>(); | ||
const collapsed = ref(false); | ||
const container = ref<HTMLDivElement | null>(null); | ||
watch( | ||
collapsed, | ||
(value) => { | ||
// Use requestAnimationFrame to prevent layout thrashing | ||
requestAnimationFrame(() => { | ||
if (!container.value) { | ||
return; | ||
} | ||
container.value.style.maxHeight = value | ||
? "0px" | ||
: `${container.value.scrollHeight}px`; | ||
}); | ||
}, | ||
{ immediate: true }, | ||
); | ||
</script> |
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,59 @@ | ||
<template> | ||
<div class="max-w-7xl mx-auto my-12 px-4"> | ||
<div class="md:max-w-sm w-full relative mb-4"> | ||
<TextInput v-model="search" placeholder="Search" class="pl-8" /> | ||
<iconify-icon icon="tabler:search" | ||
class="absolute size-4 top-1/2 left-2.5 transform -translate-y-1/2 text-gray-200" aria-hidden="true" | ||
width="unset" /> | ||
</div> | ||
<Category v-if="emojis.length > 0" v-for="([name, emojis]) in categories" :key="name" :emojis="emojis" | ||
:name="name" /> | ||
<div v-else class="flex flex-col items-center justify-center gap-2 text-gray-200 text-center p-10"> | ||
<span class="text-lg font-semibold">No emojis found.</span> | ||
<span class="text-sm"> | ||
You can ask your administrator to add some emojis. | ||
</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { Emoji } from "@versia/client/types"; | ||
import TextInput from "~/components/inputs/text-input.vue"; | ||
import Category from "./category.vue"; | ||
const emojis = computed(() => | ||
( | ||
(identity.value?.emojis as | ||
| (Emoji & { id: string; global: boolean })[] | ||
| undefined) ?? [] | ||
).filter((emoji) => | ||
emoji.shortcode.toLowerCase().includes(search.value.toLowerCase()), | ||
), | ||
); | ||
const search = ref(""); | ||
const categories = computed(() => { | ||
const categories = new Map< | ||
string, | ||
(Emoji & { id: string; global: boolean })[] | ||
>(); | ||
for (const emoji of emojis.value) { | ||
if (!emoji.category) { | ||
if (!categories.has("Uncategorized")) { | ||
categories.set("Uncategorized", []); | ||
} | ||
categories.get("Uncategorized")?.push(emoji); | ||
continue; | ||
} | ||
if (!categories.has(emoji.category)) { | ||
categories.set(emoji.category, []); | ||
} | ||
categories.get(emoji.category)?.push(emoji); | ||
} | ||
return categories; | ||
}); | ||
</script> |
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,33 @@ | ||
<template> | ||
<AdaptiveDropdown> | ||
<template #button> | ||
<Button theme="outline"> | ||
<iconify-icon width="none" icon="tabler:dots" class="size-5 text-gray-200" | ||
aria-hidden="true" /> | ||
<span class="sr-only">Open menu</span> | ||
</Button> | ||
</template> | ||
|
||
<template #items> | ||
<Menu.ItemGroup> | ||
<Menu.Item value=""> | ||
<ButtonDropdown icon="tabler:trash" class="w-full"> | ||
Delete | ||
</ButtonDropdown> | ||
</Menu.Item> | ||
</Menu.ItemGroup> | ||
</template> | ||
</AdaptiveDropdown> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { Menu } from "@ark-ui/vue"; | ||
import type { Emoji } from "@versia/client/types"; | ||
import ButtonDropdown from "~/components/buttons/button-dropdown.vue"; | ||
import AdaptiveDropdown from "~/components/dropdowns/AdaptiveDropdown.vue"; | ||
import Button from "~/packages/ui/components/buttons/button.vue"; | ||
defineProps<{ | ||
emoji: Emoji & { id: string; global: boolean }; | ||
}>(); | ||
</script> |
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,17 @@ | ||
<template> | ||
<div class="rounded ring-1 m-1 ring-white/10 grid grid-cols-[auto,1fr] gap-x-4 p-3 bg-dark-400 hover:ring-2 hover:ring-primary-600 duration-100 items-center"> | ||
<Avatar :src="emoji.url" class="size-12 rounded bg-transparent" /> | ||
<div class="text-ellipsis font-mono text-wrap w-full overflow-hidden">{{ emoji.shortcode }}</div> | ||
<!-- <GridItemMenu :emoji="emoji" /> --> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { Emoji } from "@versia/client/types"; | ||
import Avatar from "~/components/avatars/avatar.vue"; | ||
import GridItemMenu from "./grid-item-menu.vue"; | ||
defineProps<{ | ||
emoji: Emoji & { id: string; global: boolean }; | ||
}>(); | ||
</script> |
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