Skip to content

Commit

Permalink
dev : setup editor rework
Browse files Browse the repository at this point in the history
- セットアップエディタのリワークを開始
  • Loading branch information
Liry24 committed Feb 18, 2025
1 parent b03f446 commit d6f335b
Show file tree
Hide file tree
Showing 9 changed files with 262 additions and 218 deletions.
6 changes: 4 additions & 2 deletions components/edit/image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ defineExpose({
<button
v-if="!imagePreview"
ref="dropZoneRef"
type="button"
@click="open()"
:class="[
'h-40 flex flex-col items-center justify-center w-full rounded-xl border-4 border-dashed border-zinc-300 dark:border-zinc-600',
'h-40 w-full flex flex-col items-center justify-center',
'rounded-xl cursor-pointer',
'border-4 border-dashed border-zinc-300 dark:border-zinc-600',
isOverDropZone
? 'bg-zinc-500 dark:bg-zinc-400'
: 'hover:bg-zinc-200 dark:hover:bg-black/15 ',
Expand Down Expand Up @@ -110,6 +113,5 @@ defineExpose({
{{ files[0].name }}
</div>
</div>
<PopupUploadImage class="w-fit" />
</div>
</template>
20 changes: 11 additions & 9 deletions components/edit/items/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { twMerge } from 'tailwind-merge';
import { VueDraggable } from 'vue-draggable-plus';
const { class: propClass } = defineProps<{ class?: string | string[] }>();
const emit = defineEmits(['undo', 'redo']);
const items = defineModel<{
Expand Down Expand Up @@ -183,9 +185,9 @@ quickAvatarsOwned.value = await getOwnedAvatars();
</script>

<template>
<div class="flex-col items-center gap-8 flex w-full">
<div :class="twMerge('flex-col items-center gap-8 flex', propClass)">
<div class="w-full flex flex-col gap-4 items-stretch">
<div class="flex gap-1 items-center">
<!-- <div class="flex gap-1 items-center">
<UiTextinput
v-model="inputUrl"
:disabled="adding"
Expand Down Expand Up @@ -220,10 +222,10 @@ quickAvatarsOwned.value = await getOwnedAvatars();
class="pr-3"
@click="addItemFromURL"
/>
</div>
</div> -->

<div class="gap-2 flex flex-wrap items-center justify-between">
<div class="self-end gap-1 flex items-center">
<div class="gap-2 flex items-center">
<div class="grow gap-1 flex items-center">
<Button
icon="lucide:undo-2"
variant="flat"
Expand Down Expand Up @@ -286,9 +288,9 @@ quickAvatarsOwned.value = await getOwnedAvatars();
</div>

<Button
icon="lucide:search"
label="アバター・アイテムを検索"
class="h-9"
icon="lucide:plus"
label="アバター・アイテムを追加"
class="px-4"
@click="modalSearchItem = true"
/>
</div>
Expand All @@ -301,7 +303,7 @@ quickAvatarsOwned.value = await getOwnedAvatars();
!items.accessory.length &&
!items.other.length
"
class="flex flex-col gap-6 items-center"
class="h-full flex flex-col gap-6 items-center justify-center"
>
<p class="text-sm text-zinc-600 dark:text-zinc-400">
アイテムが登録されていません
Expand Down
105 changes: 67 additions & 38 deletions components/edit/items/item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,39 @@ const booth_url = 'https://booth.pm/ja/items/';

<template>
<div
class="w-full flex flex-col ring-2 ring-zinc-300 dark:ring-zinc-700 rounded-lg overflow-clip"
class="flex items-center ring-2 ring-zinc-300 dark:ring-zinc-700 rounded-lg overflow-clip"
>
<div class="w-full flex items-center">
<div class="draggable cursor-move w-10 h-full p-1.5">
<div
:class="[
'draggable shrink-0 flex items-center gap-1.5',
props.size === 'lg' ? 'p-4' : 'p-1.5 pr-4',
]"
class="size-full rounded-lg flex items-center justify-center hover:bg-zinc-800 transition duration-150"
>
<div class="draggable cursor-move flex h-full">
<Icon
name="lucide:grip-vertical"
:size="18"
class="bg-zinc-400"
/>
</div>
<Icon
name="lucide:grip-vertical"
:size="22"
class="text-zinc-400"
/>
</div>
</div>

<div class="w-full py-2 pr-2 flex flex-col gap-2">
<div class="w-full flex gap-2 items-start">
<NuxtLink
:to="booth_url + props.item.id"
target="_blank"
:class="[
'rounded-lg object-cover select-none overflow-hidden',
props.size === 'lg' ? 'size-32' : 'size-20',
]"
:data-size="props.size"
class="shrink-0 select-none"
>
<NuxtImg
:src="props.item.thumbnail"
:alt="props.item.name"
:class="props.item.nsfw ? 'blur-md' : ''"
:data-size="props.size"
:data-nsfw="props.item.nsfw"
class="size-20 rounded-lg data-[size=lg]:size-32 data-[nsfw=true]:blur-md"
/>
</NuxtLink>
</div>
<div class="w-full flex gap-5 pr-4 justify-between">
<div
:class="`w-fit flex flex-col gap-3 items-start justify-center ${props.size === 'lg' ? 'h-32' : 'h-20'}`"
>
<div class="w-fit gap-2 flex items-center">

<div class="self-center w-full flex flex-col gap-3 items-start">
<div class="gap-2 flex items-center">
<NuxtLink
:to="booth_url + props.item.id"
target="_blank"
Expand Down Expand Up @@ -113,25 +110,57 @@ const booth_url = 'https://booth.pm/ja/items/';
</NuxtLink>
</div>
</div>

<div
class="shrink-0 w-fit h-full pt-2 gap-4 flex flex-col items-end justify-between"
class="self-stretch flex flex-col gap-1 items-center justify-between"
>
<Button
icon="lucide:trash"
:icon-size="16"
tooltip="アイテム削除"
class="p-3"
@click="emit('remove')"
/>
<Popup class="p-1">
<template #trigger>
<Button variant="flat" class="p-2">
<Icon
name="lucide:menu"
size="18"
class="text-zinc-300"
/>
</Button>
</template>

<template #content>
<div class="flex flex-col gap-0.5 text-sm min-w-32">
<Button
variant="flat"
@click="unsupported = !unsupported"
>
<Icon
name="lucide:user-x"
size="18"
class="text-zinc-400"
/>
<span>アバター非対応</span>
</Button>
<Button variant="flat" @click="emit('remove')">
<Icon
name="lucide:x"
size="18"
class="text-red-400"
/>
<span class="text-red-400">削除</span>
</Button>
</div>
</template>
</Popup>

<UiCheckbox v-model="unsupported" label="アバター非対応" />
<UiTooltip v-if="unsupported" text="アバター非対応">
<Icon
name="lucide:user-x"
size="16"
class="text-zinc-300"
/>
</UiTooltip>
</div>
</div>
</div>
<div class="empty:hidden w-full flex">
<div
:class="`w-full flex flex-col items-end gap-2 ${props.size === 'lg' ? 'px-4 pb-3' : 'px-1.5 pt-1 pb-2'}`"
>

<div class="w-full flex flex-col gap-2">
<div
:class="[
'w-full px-3 py-2 gap-2 flex items-center rounded-lg bg-zinc-200 dark:bg-zinc-800 ring-inset ring-1 ring-zinc-300 dark:ring-zinc-700',
Expand Down
141 changes: 141 additions & 0 deletions components/edit/sidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<script lang="ts" setup>
import { twMerge } from 'tailwind-merge';
const emit = defineEmits(['publish']);
const title = defineModel<string>('title', { default: '' });
const description = defineModel<string>('description', { default: '' });
const tags = defineModel<string[]>('tags', { default: [] });
const coAuthors = defineModel<
{
id: string;
name: string;
avatar: string;
note: string;
}[]
>('coAuthors', { default: [] });
const image = defineModel<File | null>('image', { default: null });
const publishing = defineModel<boolean>('publishing', { default: false });
const { class: propClass } = defineProps<{ class?: string | string[] }>();
const router = useRouter();
</script>

<template>
<div
:class="
twMerge(
'relative rounded-lg',
'flex flex-col',
'ring-2 ring-zinc-200 dark:ring-zinc-700',
'bg-zinc-100 dark:bg-zinc-800',
propClass
)
"
>
<div class="sticky top-0 left-0 right-0 p-5 flex gap-1 bg-zinc-800">
<Button
:label="!publishing ? '公開' : '処理中'"
:icon="
!publishing ? 'lucide:upload' : 'i-svg-spinners-ring-resize'
"
:icon-size="18"
variant="flat"
class="grow rounded-full px-4 whitespace-nowrap hover:bg-zinc-700 hover:text-zinc-200 dark:text-zinc-900 dark:bg-zinc-300 hover:dark:text-zinc-100"
@click="emit('publish')"
>
</Button>

<Button
tooltip="破棄"
icon="lucide:trash"
:icon-size="18"
variant="flat"
class="rounded-full"
@click="router.back()"
/>
</div>

<div class="p-5 pt-2 flex flex-col gap-8">
<div class="w-full flex flex-col items-start gap-3">
<div class="w-full flex gap-2 items-center justify-between">
<UiTitle label="タイトル" icon="lucide:text" />
<UiCount
v-if="title.length"
:count="title.length"
:max="setupLimits().title"
/>
</div>
<UiTextarea
v-model="title"
placeholder="セットアップ名"
class="w-full"
/>
</div>

<div class="w-full flex flex-col items-start gap-3">
<div class="w-full flex gap-2 items-center justify-between">
<UiTitle label="画像" icon="lucide:image" />
<PopupUploadImage>
<button
type="button"
class="cursor-pointer flex items-center gap-1"
>
<Icon
name="lucide:info"
class="text-indigo-400 dark:text-indigo-300"
/>
<span
class="text-xs font-medium text-zinc-600 dark:text-zinc-300"
>
画像の添付について
</span>
</button>
</PopupUploadImage>
</div>
<EditImage ref="editImage" v-model="image" />
</div>

<div class="w-full flex flex-col items-start gap-3">
<div class="w-full flex gap-2 items-center justify-between">
<UiTitle label="説明" icon="lucide:text" />
<UiCount
v-if="description.length"
:count="description.length"
:max="setupLimits().description"
/>
</div>
<UiTextarea
v-model="description"
placeholder="説明"
class="w-full"
/>
</div>

<div class="w-full flex flex-col items-start gap-3">
<div class="w-full flex gap-2 items-center justify-between">
<UiTitle label="タグ" icon="lucide:tags" />
<UiCount
v-if="tags.length"
:count="tags.length"
:max="setupLimits().tags"
/>
</div>
<EditTags v-model="tags" />
</div>

<div class="w-full flex flex-col items-start gap-3">
<div class="w-full flex gap-2 items-center justify-between">
<UiTitle label="共同作者" icon="lucide:users-round" />
<UiCount
v-if="coAuthors.length"
:count="coAuthors.length"
:max="setupLimits().coAuthors"
/>
</div>
<EditCoAuthor v-model="coAuthors" />
</div>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion components/modal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const emit = defineEmits(['update:open']);
twMerge(
'z-[100] fixed inset-0 place-self-center max-h-[85vh] w-[90vw] max-w-[450px] p-6 flex flex-col gap-5',
'rounded-2xl bg-zinc-100 dark:bg-zinc-900 focus:outline-hidden border border-zinc-300 dark:border-zinc-700 shadow-xl',
'animate-in slide-in-from-bottom-10 fade-in ease-in-out',
'animate-in slide-in-from-bottom-3 fade-in ease-in-out',
props.class
)
"
Expand Down
Loading

0 comments on commit d6f335b

Please sign in to comment.