File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,13 @@ import text from "./text";
88
99export const locationPlaceholder = "Type your location here" ;
1010
11+ const noSection = {
12+ id : "0" ,
13+ name : "No Section" ,
14+ color : "#ffffff" ,
15+ stroke : "#ffffff"
16+ } ;
17+
1118const initialState = {
1219 cursor : null ,
1320 showControls : false ,
@@ -39,11 +46,7 @@ const initialState = {
3946 }
4047 ] ,
4148 sections : [
42- {
43- id : "0" ,
44- name : "No Section" ,
45- color : "#ffffff"
46- } ,
49+ noSection ,
4750 {
4851 id : uuidv4 ( ) ,
4952 name : "Section 1" ,
@@ -210,8 +213,9 @@ export const slice = createSlice({
210213 state . selectedPolylineId = action . payload ;
211214 } ,
212215 sync : ( state , action ) => {
213- const { name, ...data } = action . payload as ISTKData ;
216+ const { name, sections , ...data } = action . payload as ISTKData ;
214217 state . location = name ?? state . location ;
218+ state . sections = sections ? [ noSection , ...sections ] : state . sections ;
215219 Object . keys ( data ) . forEach ( ( key ) => {
216220 state [ key ] = data [ key ] ?? state [ key ] ;
217221 } ) ;
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ export const stateToJSON = () => {
9191 return {
9292 name : state . location ,
9393 categories : state . categories ,
94- sections : state . sections ,
94+ sections : state . sections . slice ( 1 ) ,
9595 seats : domSeatsToJSON ( ) ,
9696 booths : domBoothsToJSON ( ) ,
9797 text : domTextToJSON ( ) ,
You can’t perform that action at this time.
0 commit comments