]> git.r.bdr.sh - rbdr/map/blobdiff - Map/Views/MapDetail.swift
Add sidebar menu
[rbdr/map] / Map / Views / MapDetail.swift
index a8ea3d17fa054611e46f4a5ae66c34299973e6f9..6ba92bb76f9fff10ad9f0ad20cea2c983f41dd1a 100644 (file)
@@ -38,8 +38,6 @@ struct MapDetailView: View {
     )
   }
 
-  @State private var selectedEvolution = StageType.general
-
   var body: some View {
     if map.uuid != nil {
       VSplitView {
@@ -59,14 +57,10 @@ struct MapDetailView: View {
               Image(systemName: "photo")
             }.padding(.vertical, 4.0).padding(.leading, 4.0).padding(.trailing, 8.0)
           }
-          Picker("Evolution", selection: $selectedEvolution) {
-            ForEach(StageType.allCases) { stage in
-              Text(Stage.title(stage)).tag(stage).padding(4.0)
-            }
-          }.padding(.horizontal, 8.0).padding(.vertical, 4.0)
+          EvolutionPicker()
 
           ZStack(alignment: .topLeading) {
-            MapTextEditor(text: content).onChange(of: map.content) { _ in
+            MapTextEditor(text: content, colorScheme: colorScheme).onChange(of: map.content) { _ in
               try? viewContext.save()
             }
             .background(mapColor.background)
@@ -76,7 +70,8 @@ struct MapDetailView: View {
             5.0)
         }.padding(.horizontal, 8.0)
         ScrollView([.horizontal, .vertical]) {
-          MapRenderView(map: map, evolution: Stage.stages(selectedEvolution))
+          MapRenderView(
+            content: content.wrappedValue, evolution: Stage.stages(store.state.selectedEvolution))
         }.background(mapColor.background)
       }
     } else {
@@ -89,7 +84,7 @@ struct MapDetailView: View {
   }
 
   private func saveImage() {
-    store.send(.exportMapAsImage(map: map, evolution: selectedEvolution))
+    store.send(.exportMapAsImage(map: map))
   }
 }