mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
refactor: ♻️ Refine emoji uploader and table UI
This commit is contained in:
parent
17bb75733c
commit
412e49dfe2
28
components/form/switch.vue
Normal file
28
components/form/switch.vue
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<Card class="p-4">
|
||||||
|
<FormItem class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2">
|
||||||
|
<CardHeader class="flex flex-col gap-1.5 p-0">
|
||||||
|
<FormLabel class="font-semibold tracking-tight" :as="CardTitle">
|
||||||
|
{{ title }}
|
||||||
|
</FormLabel>
|
||||||
|
<CardDescription class="text-xs leading-none" v-if="description">
|
||||||
|
{{ description }}
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<FormControl>
|
||||||
|
<slot />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
</Card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||||
|
import { FormControl, FormItem, FormLabel, FormMessage } from "../ui/form";
|
||||||
|
|
||||||
|
const { title, description } = defineProps<{
|
||||||
|
title: string;
|
||||||
|
description?: string;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
@ -35,6 +35,8 @@ import {
|
||||||
} from "@tanstack/vue-table";
|
} from "@tanstack/vue-table";
|
||||||
import type { Emoji } from "@versia/client/types";
|
import type { Emoji } from "@versia/client/types";
|
||||||
import {
|
import {
|
||||||
|
ArrowDownAZ,
|
||||||
|
ArrowUpAz,
|
||||||
ArrowUpDown,
|
ArrowUpDown,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
Ellipsis,
|
Ellipsis,
|
||||||
|
|
@ -112,7 +114,13 @@ const columns: ColumnDef<Emoji>[] = [
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Shortcode
|
Shortcode
|
||||||
|
{column.getIsSorted() === false ? (
|
||||||
<ArrowUpDown class="ml-2 size-4" />
|
<ArrowUpDown class="ml-2 size-4" />
|
||||||
|
) : column.getIsSorted() === "asc" ? (
|
||||||
|
<ArrowDownAZ class="ml-2 size-4" />
|
||||||
|
) : (
|
||||||
|
<ArrowUpAz class="ml-2 size-4" />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -133,7 +141,13 @@ const columns: ColumnDef<Emoji>[] = [
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Category
|
Category
|
||||||
|
{column.getIsSorted() === false ? (
|
||||||
<ArrowUpDown class="ml-2 size-4" />
|
<ArrowUpDown class="ml-2 size-4" />
|
||||||
|
) : column.getIsSorted() === "asc" ? (
|
||||||
|
<ArrowDownAZ class="ml-2 size-4" />
|
||||||
|
) : (
|
||||||
|
<ArrowUpAz class="ml-2 size-4" />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<DialogDescription class="sr-only">
|
<DialogDescription class="sr-only">
|
||||||
{{ m.frail_great_marten_pet() }}
|
{{ m.frail_great_marten_pet() }}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
<form class="p-4 grid gap-6" @submit="submit">
|
<form class="grid gap-6" @submit="submit">
|
||||||
<div
|
<div
|
||||||
v-if="values.image"
|
v-if="values.image"
|
||||||
class="flex items-center justify-around *:size-20 *:p-2 *:rounded *:border *:shadow"
|
class="flex items-center justify-around *:size-20 *:p-2 *:rounded *:border *:shadow"
|
||||||
|
|
@ -125,32 +125,18 @@
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
v-slot="{ componentField, value, handleChange }"
|
v-slot="{ value, handleChange }"
|
||||||
v-if="hasEmojiAdmin"
|
v-if="hasEmojiAdmin"
|
||||||
name="global"
|
name="global"
|
||||||
:as="Card"
|
as-child
|
||||||
>
|
>
|
||||||
<FormItem
|
<FormSwitch :title="m.pink_sharp_carp_work()" :description="m.dark_pretty_hyena_link()">
|
||||||
class="grid grid-cols-[1fr_auto] items-center gap-2"
|
|
||||||
>
|
|
||||||
<CardHeader class="space-y-0.5 p-0">
|
|
||||||
<FormLabel :as="CardTitle">
|
|
||||||
{{ m.pink_sharp_carp_work() }}
|
|
||||||
</FormLabel>
|
|
||||||
<CardDescription>
|
|
||||||
{{ m.dark_pretty_hyena_link() }}
|
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
<FormControl>
|
|
||||||
<Switch
|
<Switch
|
||||||
:checked="value"
|
:model-value="value"
|
||||||
@update:checked="handleChange"
|
@update:model-value="handleChange"
|
||||||
v-bind="componentField"
|
|
||||||
:disabled="isSubmitting"
|
:disabled="isSubmitting"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormSwitch>
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
|
|
@ -178,6 +164,7 @@ import { RolePermission } from "@versia/client/types";
|
||||||
import { useForm } from "vee-validate";
|
import { useForm } from "vee-validate";
|
||||||
import { toast } from "vue-sonner";
|
import { toast } from "vue-sonner";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import FormSwitch from "~/components/form/switch.vue";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue