From 75667dec2fcfb7aee49a02f2915fa59c1328a1e4 Mon Sep 17 00:00:00 2001 From: malyusgun Date: Wed, 28 Aug 2024 17:03:36 +0500 Subject: [PATCH] refactor code --- src/app/App.vue | 36 +++-- src/app/assets/main.css | 20 +++ src/app/interfaces/entities.ts | 24 ++-- src/app/interfaces/environment.ts | 22 +-- src/components/CreateEntityMenu.vue | 38 +++--- .../image}/ImagePositionMenu.vue | 129 +++++++----------- .../image}/ImageSizeMenu.vue | 80 ++--------- .../image}/ImageStateMenu.vue | 9 +- src/components/entities/share/EntityTitle.vue | 33 +++++ .../share}/TextFontMenu.vue | 2 +- .../text}/TextPositionMenu.vue | 129 ++++++++---------- .../text}/TextStateMenu.vue | 0 src/modules/BaseSidebarMenu.vue | 25 ++-- src/modules/CropImageModal.vue | 23 ++-- src/modules/EntitiesList.vue | 26 ++++ src/modules/PageBackgroundMenu.vue | 32 +++++ src/modules/entities/TextItem.vue | 108 ++------------- src/modules/entities/menu/ImageMenu.vue | 104 ++++++++++++++ src/modules/entities/menu/TextMenu.vue | 63 +++++++++ src/output.css | 32 ++++- src/shared/BaseLoader.vue | 26 ++++ 21 files changed, 557 insertions(+), 404 deletions(-) rename src/components/{editEntityMenu => entities/image}/ImagePositionMenu.vue (60%) rename src/components/{editEntityMenu => entities/image}/ImageSizeMenu.vue (59%) rename src/components/{editEntityMenu => entities/image}/ImageStateMenu.vue (92%) create mode 100644 src/components/entities/share/EntityTitle.vue rename src/components/{editEntityMenu => entities/share}/TextFontMenu.vue (100%) rename src/components/{editEntityMenu => entities/text}/TextPositionMenu.vue (51%) rename src/components/{editEntityMenu => entities/text}/TextStateMenu.vue (100%) create mode 100644 src/modules/EntitiesList.vue create mode 100644 src/modules/PageBackgroundMenu.vue create mode 100644 src/modules/entities/menu/ImageMenu.vue create mode 100644 src/modules/entities/menu/TextMenu.vue create mode 100644 src/shared/BaseLoader.vue diff --git a/src/app/App.vue b/src/app/App.vue index 4198cd4..c5176ee 100644 --- a/src/app/App.vue +++ b/src/app/App.vue @@ -5,21 +5,27 @@ const visible = ref(false); diff --git a/src/app/assets/main.css b/src/app/assets/main.css index ee3f498..47d862b 100644 --- a/src/app/assets/main.css +++ b/src/app/assets/main.css @@ -199,3 +199,23 @@ label { legend { display: block; } +::-webkit-scrollbar { + width: 10px; +} + +/* Track */ +::-webkit-scrollbar-track { + background: #484848; +} + +/* Handle */ +::-webkit-scrollbar-thumb { + border-radius: 5px; + background: #0055ff; + transition: all 0.5s ease; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #0033ff; +} diff --git a/src/app/interfaces/entities.ts b/src/app/interfaces/entities.ts index 956d3fb..0767db1 100644 --- a/src/app/interfaces/entities.ts +++ b/src/app/interfaces/entities.ts @@ -3,18 +3,18 @@ import type { IEntity } from '@/app/interfaces/environment'; export interface ITable extends IEntity { entity_type: 'table'; entity_uuid: string; - title?: string; - text?: string; + title?: string | null; + text?: string | null; table_columns: ITableColumn[]; table_data: { - [key: string]: any; + [key: string]: never; }[]; } -interface ITableColumn { +export interface ITableColumn { column_uuid: string; name: string; type: ITableColumnTypes; - data: any; + data: never; } type ITableColumnTypes = | 'text' @@ -29,7 +29,7 @@ type ITableColumnTypes = export interface IText extends IEntity { entity_type: 'text'; entity_uuid: string; - title?: string; + title?: string | null; text: string; font_size?: '16' | '20' | '24' | '40' | '64'; paragraph_size?: 'full' | 'half'; @@ -40,12 +40,12 @@ export interface IText extends IEntity { export interface IImage extends IEntity { entity_type: 'image'; entity_uuid: string; - title?: string; - text?: string; - font_size?: '16' | '20' | '24' | '40' | '64'; - paragraph_size?: 'full' | 'half'; - text_position?: 'left' | 'right'; - image_url: string; + title?: string | null; + text?: string | null; + font_size?: '16' | '20' | '24' | '40' | '64' | null; + paragraph_size?: 'full' | 'half' | null; + text_position?: 'left' | 'right' | null; + imageUrl: string; image_width: number; image_height: number; image_scale: string; diff --git a/src/app/interfaces/environment.ts b/src/app/interfaces/environment.ts index e1159fe..c0a1f38 100644 --- a/src/app/interfaces/environment.ts +++ b/src/app/interfaces/environment.ts @@ -1,3 +1,5 @@ +import type { ITableColumn } from '@/app/interfaces/entities'; + export interface ISheet { sheet_uuid: string; title: string; @@ -11,20 +13,22 @@ export interface IEntity { user_nick_name?: string; entity_order?: number; entity_type: string; - title?: string; - text?: string; - font_size?: string; - paragraph_size?: string; - text_position?: string; - image_blob?: string; - image_url?: string; + title?: string | null; + text?: string | null; + font_size?: string | null; + paragraph_size?: string | null; + text_position?: string | null; + image_buffer?: string; + imageUrl?: string; image_width?: number; image_height?: number; entity_position?: string; entity_title_position?: string; image_scale?: string; - table_columns?: string; - table_data?: string; + table_columns?: ITableColumn[]; + table_data?: { + [key: string]: never; + }[]; } export type TThemes = diff --git a/src/components/CreateEntityMenu.vue b/src/components/CreateEntityMenu.vue index bd8d27b..60176cd 100644 --- a/src/components/CreateEntityMenu.vue +++ b/src/components/CreateEntityMenu.vue @@ -1,40 +1,40 @@ @@ -126,8 +70,8 @@ const speedDialSizeBigger = computed(() => { :style="`width: ${props.entityData.image_width}px; height: ${props.entityData.image_height}px`" > -import { deleteEntity } from '@/app/helpers'; import type { IImage } from '@/app/interfaces/entities'; +import { deleteEntity } from '@/app/helpers'; interface Props { entityData: IImage; @@ -12,7 +12,7 @@ const emit = defineEmits([ 'removeTitle', 'addText', 'removeText', - 'openUploadFileModal' + 'openCropImageModal' ]); const speedDialState = computed(() => { @@ -51,7 +51,7 @@ const speedDialState = computed(() => { state.push({ label: 'Crop', icon: 'pi pi-expand', - command: () => emit('openUploadFileModal') + command: () => emit('openCropImageModal') }); } state.push({ @@ -82,7 +82,8 @@ const speedDialState = computed(() => {