-
-
-
-
+
@@ -71,12 +73,13 @@ textarea {
textarea::-webkit-scrollbar {
display: none;
}
-.textContainer > .addTitleButton,
-.textContainer > .deleteEntityButton {
+.entityContainer > .speedDial {
opacity: 0;
}
-.textContainer:hover > .addTitleButton,
-.textContainer:hover > .deleteEntityButton{
+.entityContainer:hover > .speedDial {
opacity: 100;
}
+input::placeholder {
+ font-weight: 400;
+}
diff --git a/src/helpers/index.ts b/src/helpers/index.ts
index eb5badfc9a3fc44cbe6b582df3b6e8479680994e..a36d3f01254a8fa62183ec0e92402578e20caf89 100644
--- a/src/helpers/index.ts
+++ b/src/helpers/index.ts
@@ -1,5 +1,6 @@
import { useInterfaceStore } from '@/stores/interface';
import type { IEntity } from '@/interfaces/environment';
+import { useDataStore } from '@/stores/data';
export async function uploadFile($event: Event) {
const target = $event.target as HTMLInputElement;
@@ -23,3 +24,38 @@ export function setDefaultHomeBackground() {
);
localStorage.removeItem('homeBackgroundUrl');
}
+
+export const editEntity = (newState: IEntity, entityUuid: string) => {
+ const dataStore = useDataStore();
+ let prevState = dataStore.homeEntities;
+ prevState = prevState.map((entity: IEntity) => {
+ if (entity.uuid !== entityUuid) return entity;
+ return newState;
+ });
+ dataStore.editHomeEntities(prevState);
+};
+
+export const deleteEntity = (entityUuid: string) => {
+ const dataStore = useDataStore();
+ let prevState = dataStore.homeEntities;
+ prevState = prevState.filter((entity: IEntity) => entity.uuid !== entityUuid);
+ dataStore.editHomeEntities(prevState);
+};
+
+export const changeOrderHomeEntity = (entityUuid: string, direction: 'up' | 'down') => {
+ const dataStore = useDataStore();
+ const prevState = dataStore.homeEntities;
+ const entityIndex = prevState.findIndex((entity: IEntity) => entity.uuid === entityUuid);
+ if (direction === 'up') {
+ [prevState[entityIndex], prevState[entityIndex - 1]] = [
+ prevState[entityIndex - 1],
+ prevState[entityIndex]
+ ];
+ } else {
+ [prevState[entityIndex], prevState[entityIndex + 1]] = [
+ prevState[entityIndex + 1],
+ prevState[entityIndex]
+ ];
+ }
+ dataStore.editHomeEntities(prevState);
+};
diff --git a/src/interfaces/entities.ts b/src/interfaces/entities.ts
index 5728cb7802117638a791c99049e9a8e72f76d2e1..fffff4dcf2cac2f6a843421db30a48da282a1cce 100644
--- a/src/interfaces/entities.ts
+++ b/src/interfaces/entities.ts
@@ -31,8 +31,9 @@ export interface IText {
export interface IImage {
type: 'image';
uuid: string;
- name: string;
+ title: string;
url: string;
width: number;
height: number;
+ position: 'left' | 'center' | 'right';
}
diff --git a/src/modules/EntityItem.vue b/src/modules/EntityItem.vue
index b2732984d98cb9a9c9e52fe192df1f71e3506c77..01fb2f80f28637dcba4f31243172626a9f71e6c0 100644
--- a/src/modules/EntityItem.vue
+++ b/src/modules/EntityItem.vue
@@ -1,6 +1,7 @@