Skip to content

Commit

Permalink
feat(editor): blocked editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Sep 22, 2021
1 parent 9a38f9c commit aa7d1e4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
3 changes: 2 additions & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ declare module 'vue' {
Disclosure: typeof import('@headlessui/vue')['Disclosure']
DisclosureButton: typeof import('@headlessui/vue')['DisclosureButton']
DisclosurePanel: typeof import('@headlessui/vue')['DisclosurePanel']
EditorBase: typeof import('E:/dev/projects/write-better/src/components/editor/EditorBase.vue')['default']
EditorBase: typeof import('E:/dev/projects/write-better/src/components/editor/main/EditorBase.vue')['default']
EditorBaseBlocked: typeof import('E:/dev/projects/write-better/src/components/editor/main/EditorBaseBlocked.vue')['default']
EditorHeader: typeof import('E:/dev/projects/write-better/src/components/editor/EditorHeader.vue')['default']
HeroIcon: typeof import('E:/dev/projects/write-better/src/components/utils/HeroIcon.vue')['default']
LangSwitcher: typeof import('E:/dev/projects/write-better/src/components/utils/LangSwitcher.vue')['default']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
rgba(0, 0, 0, 0.05) 0px 1px 1px 0px;
"
>
<EditorBaseBlocked
v-if="store.state.project.name === '__NOT_CREATED__'"
/>
<section
id="edit"
class="flex flex-col w-full overflow-y-auto max-h-editor px-14"
Expand All @@ -18,7 +21,11 @@
:page="page"
/>
</section>
<TextInput v-model="entry" @enter="enterListener" />
<TextInput
v-if="store.state.project.name !== '__NOT_CREATED__'"
v-model="entry"
@enter="enterListener"
/>
</div>
</div>
</template>
Expand Down
11 changes: 11 additions & 0 deletions src/components/editor/main/EditorBaseBlocked.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div class="z-50 flex justify-center items-center w-full h-editor border">
<p class="wb-text font-bold">{{ t('editor.aside.project.blocked') }}</p>
</div>
</template>

<script lang="ts" setup>
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
</script>
1 change: 1 addition & 0 deletions src/lang/br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
},
project: {
title: 'Projeto',
blocked: 'Crie ou carregue um projeto!!!',
new: {
title: 'Novo Projeto',
name: 'Nome',
Expand Down
1 change: 1 addition & 0 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
},
project: {
title: 'Project',
blocked: 'Create or load a project!!!',
new: {
title: 'New Project',
name: 'Name',
Expand Down
7 changes: 4 additions & 3 deletions src/store/module/project.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ProjectState } from '@/types/project'
import { useText } from '@/use/text'
import { version } from 'vue-demi'
import { useFormat } from '../../use/format'

export default {
namespaced: true,
state: () =>
({
name: 'foo',
name: '__NOT_CREATED__',
version: '0.1.0',
totalPagesCreated: 0,
main: {},
Expand All @@ -26,14 +27,14 @@ export default {
{
id: 0,
type: 'heading-one',
raw: 'Untitled',
raw: payload.name,
createdAt: useFormat().actually(),
updatedAt: useFormat().actually(),
},
{
id: 1,
type: 'paragraph',
raw: 'Untitled',
raw: 'v' + payload.version,
createdAt: useFormat().actually(),
updatedAt: useFormat().actually(),
},
Expand Down

0 comments on commit aa7d1e4

Please sign in to comment.