@@ -68,8 +76,8 @@ watch(() => route.params.target, () => {
-
-
+
@@ -93,21 +101,4 @@ watch(() => route.params.target, () => {
filter: blur(10px);
transition: all 300ms linear;
}
-
-.homelink {
- position: absolute;
- right: 2rem;
- top: 4rem;
-
- a {
- background-color: #2D3031;
- color: #fff;
- line-height: 1;
- font-size: 3rem;
- height: 7rem;
- display: flex;
- align-items: center;
- border-radius: 0.5rem;
- }
-}
\ No newline at end of file
diff --git a/front/src/components/Promo/sidebar.vue b/front/src/components/Promo/sidebar.vue
index 987b390..3e227b1 100644
--- a/front/src/components/Promo/sidebar.vue
+++ b/front/src/components/Promo/sidebar.vue
@@ -10,15 +10,28 @@ const sidebar_obj = ref()
const route = useRoute()
+const opened_desc = ref()
+
+const openedChange = () => {
+ sidebar.open(opened_desc.value)
+}
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/front/src/index.d.ts b/front/src/index.d.ts
index bb20305..cff4c8e 100644
--- a/front/src/index.d.ts
+++ b/front/src/index.d.ts
@@ -65,12 +65,7 @@ interface PromoSidebar extends PromoSidebarData {
}
interface PromoScene {
id: number
- model_file: string
name: string
- description?: string
- parent?: number
- is_enabled: boolean
- can_not_disable: boolean
}
interface EnvVars {
focus: number,
diff --git a/front/src/stores/clickable.ts b/front/src/stores/clickable.ts
new file mode 100644
index 0000000..88d0b80
--- /dev/null
+++ b/front/src/stores/clickable.ts
@@ -0,0 +1,11 @@
+import { defineStore } from 'pinia'
+interface state {
+ list: clickableAreaType[]
+}
+export const useClickable = defineStore('clickable', {
+ state: () => {
+ return {
+ list: []
+ } as state
+ },
+})
diff --git a/front/src/stores/floorplan.ts b/front/src/stores/floorplan.ts
deleted file mode 100644
index 20c348b..0000000
--- a/front/src/stores/floorplan.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { defineStore } from 'pinia'
-import { SERVER_URL } from '../constants'
-import { chunks } from '../helpers'
-
-export const useFloorplanStore = defineStore('floorplan', {
- state: () => {
- return {
- items: [] as { id: string, title: string }[],
- title: undefined,
- np_array: [] as number[][],
- prepared_array: [] as number[][],
- chunk_size: undefined as number | undefined,
- threshold: undefined as number | undefined,
- points: [] as { type: string, title: string, points: { x: number, y: number } }[]
- }
- },
- actions: {
- async getList() {
- try {
- const res = await fetch(`${SERVER_URL}/api/floorplan/`, {
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'
- },
- })
- const data = await res.json()
- this.items = data
- // this.title = data.title
- // this.np_array = data.np_field
- } catch (error) {
- console.log(error)
- }
- },
- async getData(id: number) {
- try {
- const res = await fetch(`${SERVER_URL}/api/floorplan/${id}`, {
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'
- },
- })
- const data = await res.json()
- this.title = data.title
- this.np_array = data.np_field
- this.chunk_size = data.d_size || 8
- this.threshold = data.d_border || 20
-
- this.prepared_array = [...chunks(data.np_field, this.chunk_size as number)].map(line => {
- const line_data = [] as any[][]
- line.map((item: any) => [...chunks(item, this.chunk_size as number)]).map((item) => {
- item.map((one_line, k) => {
- if (!line_data[k]) line_data[k] = []
- line_data[k].push(...one_line)
- })
- })
- return line_data.map(el => {
- return el.filter(e => e > 0).length > (this.threshold as number) ? 1 : 0
- })
- });
- await this.getPoints(id)
- } catch (error) {
- console.log(error)
- }
- },
- async getPoints(id: number) {
- const res = await fetch(`${SERVER_URL}/api/floorplan/${id}/points`, {
- headers: {
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'
- },
- })
- const data = await res.json()
- this.points = data.points
- }
- }
-})
\ No newline at end of file
diff --git a/front/src/stores/product.ts b/front/src/stores/product.ts
deleted file mode 100644
index 2421737..0000000
--- a/front/src/stores/product.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { defineStore } from 'pinia'
-import { SERVER_URL } from '../constants'
-
-export const useProductStore = defineStore('product', {
- state: () => {
- return {
- // for initially empty lists
- list: [] as ProductInfo[],
- }
- },
- actions: {
- async getData() {
- try {
- const res = await fetch(`${SERVER_URL}/api/products`)
- const data = await res.json()
- if (data.length) {
- this.list = data
- }
- } catch (error) {
- this.list = []
- }
- },
- }
-})
diff --git a/front/src/stores/promo_scene.ts b/front/src/stores/promo_scene.ts
index c16c854..98680fd 100644
--- a/front/src/stores/promo_scene.ts
+++ b/front/src/stores/promo_scene.ts
@@ -1,8 +1,15 @@
import { defineStore } from 'pinia'
+type state = {
+ name: string,
+ list: PromoScene[]
+}
export const usePromoScene = defineStore('promo_scene', {
state: () => {
- return { list: [] as PromoScene[] }
+ return {
+ name: '',
+ list: []
+ } as state
},
actions: {
setData(data: PromoScene[]) {
diff --git a/front/src/stores/promo_sidebar.ts b/front/src/stores/promo_sidebar.ts
index 1d2067b..51ef61d 100644
--- a/front/src/stores/promo_sidebar.ts
+++ b/front/src/stores/promo_sidebar.ts
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { useClickable } from './clickable'
export const usePromoSidebar = defineStore('promo_sidebar', {
state: () => {
@@ -12,9 +13,25 @@ export const usePromoSidebar = defineStore('promo_sidebar', {
} as PromoSidebar
},
actions: {
- open() {
+ open(id: number) {
+ if (id) {
+ const clickable = useClickable()
+ const target = clickable.list.find(el => el.id == id)
+ if (!target) return
+ const sidebar_data = {
+ title: target.name,
+ description: target.description
+ } as PromoSidebarData
+ if (target?.target) {
+ sidebar_data.target = target.target.toString()
+ sidebar_data.target_name = target.target_name
+ }
+ this.setData(sidebar_data)
+ }
+
this.is_open = true
this.loading = true
+
},
setData(data: PromoSidebarData) {
this.$state = Object.assign(this.$state, data)
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index cd57f20..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "interactive-table",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {}
-}