macbook 에서 리눅스로 이동
This commit is contained in:
151
frontend/app/components/admin/CreatePageModal.vue
Normal file
151
frontend/app/components/admin/CreatePageModal.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { type CampaignLabel } from '~/stores/pages'
|
||||
|
||||
interface Props {
|
||||
campaigns: CampaignLabel[]
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'close'): void
|
||||
(e: 'submit', payload: { name: string; campaignId: string; domain: string; routePath: string }): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const form = ref({
|
||||
name: '메인 랜딩 페이지',
|
||||
campaignId: '',
|
||||
domain: 'ad-camp-temp.test',
|
||||
routePath: '/'
|
||||
})
|
||||
|
||||
const campaignChoices = computed(() =>
|
||||
props.campaigns.map((campaign) => ({
|
||||
value: campaign.id,
|
||||
label: campaign.name
|
||||
}))
|
||||
)
|
||||
|
||||
if (campaignChoices.value.length > 0) {
|
||||
form.value.campaignId = campaignChoices.value[0]?.value || ''
|
||||
}
|
||||
|
||||
const onClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
const payload = {
|
||||
name: form.value.name.trim(),
|
||||
campaignId: form.value.campaignId,
|
||||
domain: form.value.domain.trim(),
|
||||
routePath: form.value.routePath.trim()
|
||||
}
|
||||
|
||||
if (!payload.name || !payload.campaignId || !payload.domain || !payload.routePath) {
|
||||
return
|
||||
}
|
||||
|
||||
emit('submit', payload)
|
||||
form.value = {
|
||||
name: '메인 랜딩 페이지',
|
||||
campaignId: props.campaigns[0]?.id || '',
|
||||
domain: 'ad-camp-temp.test',
|
||||
routePath: '/'
|
||||
}
|
||||
}
|
||||
|
||||
const onBackdrop = (evt: MouseEvent) => {
|
||||
if (evt.target === evt.currentTarget) {
|
||||
onClose()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/70 p-4"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
@click="onBackdrop"
|
||||
>
|
||||
<div class="w-full max-w-lg rounded-2xl border border-indigo-400/20 bg-slate-950 p-6 shadow-2xl shadow-black/60">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-2xl font-bold text-white">새 페이지 만들기</h2>
|
||||
<button
|
||||
type="button"
|
||||
@click="onClose"
|
||||
class="rounded-md border border-slate-700/70 px-2 py-1 text-xs font-semibold text-slate-300"
|
||||
>
|
||||
닫기
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="mt-2 text-sm text-slate-400">페이지명/도메인/경로를 입력하고 생성하면 즉시 페이지가 등록됩니다.</p>
|
||||
|
||||
<div class="mt-5 space-y-4">
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">페이지명</span>
|
||||
<input
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
placeholder="예: 메인 랜딩 페이지"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">프로젝트</span>
|
||||
<select
|
||||
v-model="form.campaignId"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
>
|
||||
<option value="">프로젝트 선택</option>
|
||||
<option v-for="campaign in campaignChoices" :key="campaign.value" :value="campaign.value">
|
||||
{{ campaign.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">도메인</span>
|
||||
<input
|
||||
v-model="form.domain"
|
||||
type="text"
|
||||
placeholder="예: summer.example.com"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">페이지 경로</span>
|
||||
<input
|
||||
v-model="form.routePath"
|
||||
type="text"
|
||||
placeholder="예: /, /offer, /google"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@click="onClose"
|
||||
class="rounded-md border border-slate-700 px-4 py-2 text-sm text-slate-300"
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="onSubmit"
|
||||
class="rounded-md bg-gradient-to-r from-indigo-500 to-cyan-500 px-4 py-2 text-sm font-semibold text-white"
|
||||
>
|
||||
생성
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
89
frontend/app/components/admin/CreateProjectModal.vue
Normal file
89
frontend/app/components/admin/CreateProjectModal.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
interface Emits {
|
||||
(e: 'close'): void
|
||||
(e: 'submit', payload: { name: string; campaignName: string }): void
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const form = ref({
|
||||
name: '',
|
||||
campaignName: ''
|
||||
})
|
||||
|
||||
const onClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
const name = form.value.name.trim()
|
||||
const campaignName = form.value.campaignName.trim()
|
||||
|
||||
if (!name || !campaignName) {
|
||||
return
|
||||
}
|
||||
|
||||
emit('submit', { name, campaignName })
|
||||
form.value = { name: '', campaignName: '' }
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4" role="dialog" aria-modal="true">
|
||||
<div class="w-full max-w-lg rounded-2xl border border-indigo-400/20 bg-slate-950 p-6 shadow-2xl shadow-black/60">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-2xl font-bold text-white">새 프로젝트 만들기</h2>
|
||||
<button
|
||||
type="button"
|
||||
@click="onClose"
|
||||
class="rounded-md border border-slate-700/70 px-2 py-1 text-xs font-semibold text-slate-300"
|
||||
>
|
||||
닫기
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="mt-2 text-sm text-slate-400">프로젝트 기본 정보만 입력해도 바로 저장됩니다.</p>
|
||||
|
||||
<div class="mt-5 space-y-4">
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">프로젝트명</span>
|
||||
<input
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
placeholder="예: 여름 프로모션 캠페인"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="block space-y-2">
|
||||
<span class="text-sm text-slate-300">캠페인 표시명</span>
|
||||
<input
|
||||
v-model="form.campaignName"
|
||||
type="text"
|
||||
placeholder="예: 캠페인 1"
|
||||
class="w-full rounded-xl border border-indigo-500/25 bg-slate-900 px-4 py-3 text-slate-100 outline-none focus:border-cyan-300"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@click="onClose"
|
||||
class="rounded-md border border-slate-700 px-4 py-2 text-sm text-slate-300"
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="onSubmit"
|
||||
class="rounded-md bg-gradient-to-r from-indigo-500 to-cyan-500 px-4 py-2 text-sm font-semibold text-white"
|
||||
>
|
||||
생성
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
41
frontend/app/components/ui/button/index.ts
Normal file
41
frontend/app/components/ui/button/index.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { defineComponent, h } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Button',
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'button',
|
||||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default: 'default',
|
||||
validator: (value: string) => ['default', 'outline', 'ghost'].includes(value),
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const base = 'inline-flex items-center justify-center rounded-md px-4 py-2 font-medium transition';
|
||||
const styles: Record<string, string> = {
|
||||
default: 'bg-cyan-500 text-black hover:bg-cyan-400',
|
||||
outline: 'border border-slate-600 text-slate-100 bg-transparent hover:bg-slate-900',
|
||||
ghost: 'text-slate-100 hover:bg-slate-800',
|
||||
};
|
||||
|
||||
return () =>
|
||||
h(
|
||||
'button',
|
||||
{
|
||||
type: props.type as 'button' | 'submit' | 'reset',
|
||||
class: `${base} ${styles[props.variant as keyof typeof styles]} ${props.className}`.trim(),
|
||||
},
|
||||
slots.default ? slots.default() : undefined,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
export { Button };
|
||||
|
||||
Reference in New Issue
Block a user