Skip to content

Commit

Permalink
add: community templates placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
sv022 committed Dec 22, 2024
1 parent da3ec51 commit 75e25cf
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 25 deletions.
24 changes: 0 additions & 24 deletions core/client/src/pages/templates.vue

This file was deleted.

18 changes: 18 additions & 0 deletions core/client/src/pages/templates/community/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
import { LayoutsEnum } from '@/layouts/model'
definePage({
meta: {
requiresAuth: true,
layout: LayoutsEnum.empty,
},
})
</script>

<template>
<div>
<p>
test
</p>
</div>
</template>
59 changes: 59 additions & 0 deletions core/client/src/pages/templates/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script setup lang="ts">
import { ImportTemplate } from '@/entities/template'
import UiButton from '@/shared/ui/button/UiButton.vue'
import UiDialog from '@/shared/ui/dialog/UiDialog.vue'
import UiDialogContent from '@/shared/ui/dialog/UiDialogContent.vue'
import UiDialogTrigger from '@/shared/ui/dialog/UiDialogTrigger.vue'
import { AllTemplates } from '@/widgets/templates'
import { useHead } from '@unhead/vue'
import { ref, useTemplateRef } from 'vue'
import { useRoute, useRouter } from 'vue-router'
definePage({
meta: {
requiresAuth: true,
},
})
useHead({
title: 'Jenda | Templates',
})
const sheet = useTemplateRef<InstanceType<typeof UiDialog> | null>('sheet')
const route = useRoute()
const router = useRouter()
function toggleModalRoute() {
if (sheet.value && !sheet.value.open && route.name === '/templates/community/') {
router.back()
}
}
const isModalOpen = ref<boolean>(false)
</script>

<template>
<div class="flex items-center justify-between mb-5">
<p class="text-sm text-neutral-600 dark:text-neutral-300">
{{ $t('templates.description') }}
</p>
<div>
<UiDialog ref="sheet" v-model:open="isModalOpen" @update:open="toggleModalRoute">
<UiDialogTrigger as-child>
<UiButton variant="outline" @click="isModalOpen = true">
{{ $t('templates.community') }}
</UiButton>
</UiDialogTrigger>
<UiDialogContent>
<div>
placeholder
</div>
</UiDialogContent>
</UiDialog>
<UiButton variant="solid" class="ml-2" @click="$router.push('/templates/new')">
{{ $t('templates.create') }}
</UiButton>
</div>
</div>
<ImportTemplate />
<AllTemplates />
</template>
2 changes: 2 additions & 0 deletions core/client/src/shared/libs/i18n/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export default {
title: 'Templates',
description: 'Choose one of the available templates to create your project',
import: 'Click or drag files to import. Supports files',
community: 'Comunity templates',
create: 'Create new template',
user: 'creator',
items: [
{
Expand Down
2 changes: 2 additions & 0 deletions core/client/src/shared/libs/i18n/locales/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export default {
description:
'Выберите один из доступных шаблонов, чтобы создать ваш проект',
import: 'Нажмите или перетащите файлы для импорта. Поддерживает файлы',
community: 'Шаблоны сообщества',
create: 'Создать шаблон',
user: 'создатель',
items: [
{
Expand Down
3 changes: 2 additions & 1 deletion core/client/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare module 'vue-router/auto-routes' {
'/members': RouteRecordInfo<'/members', '/members', Record<never, never>, Record<never, never>>,
'/settings': RouteRecordInfo<'/settings', '/settings', Record<never, never>, Record<never, never>>,
'/tasks': RouteRecordInfo<'/tasks', '/tasks', Record<never, never>, Record<never, never>>,
'/templates': RouteRecordInfo<'/templates', '/templates', Record<never, never>, Record<never, never>>,
'/templates/': RouteRecordInfo<'/templates/', '/templates', Record<never, never>, Record<never, never>>,
'/templates/community/': RouteRecordInfo<'/templates/community/', '/templates/community', Record<never, never>, Record<never, never>>,
}
}

0 comments on commit 75e25cf

Please sign in to comment.