From c9b103ae0f4276217789de0400d6290276d0b004 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:51:27 -0500 Subject: [PATCH 1/5] various client adjustments - Temporarily disable `Save to Scanner` button so Pliny doesn't break his stuff anymore - Rename `components/drawer/geofence` folder to `components/drawer/drawing` - Make input components have less tedious props - Fancier types for those input components - Change `BtnGroup` to `MultiOptions` and add a prop that specifies Select or Buttons - Put line string arrows on their own pane and add a toggle for them - Don't scale arrows with zoom - Use less hacky svg for easy button --- client/src/assets/types.ts | 6 ++ client/src/components/dialogs/Manager.tsx | 1 + client/src/components/dialogs/Polygon.tsx | 15 +++-- .../src/components/drawer/drawing/index.tsx | 26 ++++++++ .../src/components/drawer/geofence/index.tsx | 44 ------------- client/src/components/drawer/index.tsx | 4 +- .../src/components/drawer/inputs/BtnGroup.tsx | 39 ------------ .../src/components/drawer/inputs/DateTime.tsx | 22 +++---- .../components/drawer/inputs/MultiOptions.tsx | 62 +++++++++++++++++++ .../src/components/drawer/inputs/NumInput.tsx | 34 +++++----- .../src/components/drawer/inputs/Toggle.tsx | 24 ++++--- client/src/components/drawer/manage/index.tsx | 8 +-- .../src/components/drawer/routing/index.tsx | 56 ++++------------- .../src/components/drawer/settings/index.tsx | 39 +++--------- client/src/hooks/useLayers.ts | 5 ++ client/src/hooks/usePersist.ts | 2 + client/src/pages/map/index.tsx | 5 +- client/src/pages/map/interface/index.tsx | 22 +++---- client/src/pages/map/markers/LineString.tsx | 5 +- 19 files changed, 184 insertions(+), 235 deletions(-) create mode 100644 client/src/components/drawer/drawing/index.tsx delete mode 100644 client/src/components/drawer/geofence/index.tsx delete mode 100644 client/src/components/drawer/inputs/BtnGroup.tsx create mode 100644 client/src/components/drawer/inputs/MultiOptions.tsx diff --git a/client/src/assets/types.ts b/client/src/assets/types.ts index 705996e0..c2613c79 100644 --- a/client/src/assets/types.ts +++ b/client/src/assets/types.ts @@ -7,6 +7,12 @@ import * as L from 'leaflet' import type { UsePersist } from '@hooks/usePersist' import type { UseStatic } from '@hooks/useStatic' +export type SpecificValueType = { + [k in keyof T]: T[k] extends U ? k : never +}[keyof T] + +export type OnlyType = { [k in SpecificValueType]: U } + export interface Data { gyms: PixiMarker[] pokestops: PixiMarker[] diff --git a/client/src/components/dialogs/Manager.tsx b/client/src/components/dialogs/Manager.tsx index 4c2941a0..0ba4c906 100644 --- a/client/src/components/dialogs/Manager.tsx +++ b/client/src/components/dialogs/Manager.tsx @@ -73,6 +73,7 @@ export default function Manager({ open, setOpen, geojson }: Props) { Save to Koji