From ddd853b528f679f3f06426552d5a987154f8bbba Mon Sep 17 00:00:00 2001
From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com>
Date: Tue, 22 Oct 2024 00:44:27 +0545
Subject: [PATCH 1/2] Toast Add & Update import path (#1828)
* fix(page): prettier code indentation fix
* fix(bottomSheet): improve user experience
* fix(bottom-sheet): bottom sheet component add
* fix(+page): integrate bottom sheet
* feat(pageCss): css for page route
* feat(icons): icon add
* fix(bottom-sheet): width fix
* feat(more): stacked card UI
* feat(images): lock icons add
* feat(+page): symbolLayer add to display lockIcons, more layer color add
* feat(icons): layer, legend icon add
* feat(clickOutside): handle outside click function add
* fix(+page): integrate legend and layer-switcher
* feat(legend): legend UI slice
* feat(layer-switcher): component for layer switcher
* feat(close): icon add
* fix(+page): task actions modal add
* fix(+page): only show modal if status ready or locked for mapping
* feat(icons): icon add
* feat(tiptap): tiptap rich text editor package add
* feat(editor): tiptap rich text editor add
* fix(bottom-sheet): fix css
* feat(more): implement text editor on comment section
* fix(+page): more section add
* feat(button): button css define
* fix(button): btn classes add for styling
* feat(icons): icons add
* fix(+page): icon add to task action btns
* fix(+page): change selected task boundary color on task select
* feat(asset): location image add
* feat(image): replace locationDot image
* feat(geolocate): icon add
* feat(getDeviceRotation): device orientation track function
* feat(+page): geolocation with device orientation functionality add
* fix(viteConfig): alias store path
* fix(icon): icon add
* feat(toast): reusable toast component add
* feat(layout): add toast component to the main
* feat(commonStore): create writable store to display toast
* fix(toast): show toast for 4 sec
* fix(+page): show toast if browser firefox or safari
* feat(viteConfig): add path aliases
* fix(+page): replace relative paths with absolute paths
---
.../src/lib/components/common/toast.svelte | 40 +++++++++++++++++++
src/mapper/src/routes/+layout.svelte | 2 +
.../src/routes/[projectId]/+page.svelte | 21 ++++++----
src/mapper/src/store/common.ts | 6 +++
.../assets/icons/exclamation-octagon.svg | 4 ++
.../assets/icons/exclamation-triangle.svg | 4 ++
.../static/assets/icons/info-circle.svg | 4 ++
src/mapper/vite.config.ts | 4 ++
8 files changed, 77 insertions(+), 8 deletions(-)
create mode 100644 src/mapper/src/lib/components/common/toast.svelte
create mode 100644 src/mapper/src/store/common.ts
create mode 100644 src/mapper/static/assets/icons/exclamation-octagon.svg
create mode 100644 src/mapper/static/assets/icons/exclamation-triangle.svg
create mode 100644 src/mapper/static/assets/icons/info-circle.svg
diff --git a/src/mapper/src/lib/components/common/toast.svelte b/src/mapper/src/lib/components/common/toast.svelte
new file mode 100644
index 000000000..2666bdd3c
--- /dev/null
+++ b/src/mapper/src/lib/components/common/toast.svelte
@@ -0,0 +1,40 @@
+
+
+
+
+
+ {alertInfo?.message}
+
+
+
+
diff --git a/src/mapper/src/routes/+layout.svelte b/src/mapper/src/routes/+layout.svelte
index 9b62715fe..686ffa81d 100644
--- a/src/mapper/src/routes/+layout.svelte
+++ b/src/mapper/src/routes/+layout.svelte
@@ -2,6 +2,7 @@
import '@hotosm/ui/dist/style.css';
import '@hotosm/ui/dist/hotosm-ui';
import { setBasePath } from '@hotosm/ui/dist/hotosm-ui';
+ import Toast from '$lib/components/common/toast.svelte';
setBasePath('/mapnow');
@@ -10,5 +11,6 @@
+
diff --git a/src/mapper/src/routes/[projectId]/+page.svelte b/src/mapper/src/routes/[projectId]/+page.svelte
index 14ff1a767..d5eadd6cd 100644
--- a/src/mapper/src/routes/[projectId]/+page.svelte
+++ b/src/mapper/src/routes/[projectId]/+page.svelte
@@ -40,14 +40,15 @@
import LayerSwitcher from '$lib/components/page/layer-switcher.svelte';
import BottomSheet from '$lib/components/common/bottom-sheet.svelte';
import Error from './+error.svelte';
- import '../../styles/page.css';
- import BlackLockImg from '../../assets/images/black-lock.png';
- import RedLockImg from '../../assets/images/red-lock.png';
- import More from '../../lib/components/page/more/index.svelte';
- import '../../styles/button.css';
- import { GetDeviceRotation } from '../../utilFunctions/getDeviceRotation';
- import LocationArcImg from '../../assets/images/locationArc.png';
- import LocationDotImg from '../../assets/images/locationDot.png';
+ import '$styles/page.css';
+ import BlackLockImg from '$assets/images/black-lock.png';
+ import RedLockImg from '$assets/images/red-lock.png';
+ import More from '$lib/components/page/more/index.svelte';
+ import '$styles/button.css';
+ import { GetDeviceRotation } from '$utilFunctions/getDeviceRotation';
+ import LocationArcImg from '$assets/images/locationArc.png';
+ import LocationDotImg from '$assets/images/locationDot.png';
+ import { setAlert } from '$store/common';
export let data: PageData;
@@ -256,6 +257,10 @@
$: if (map && toggleGeolocationStatus) {
if (isFirefox || isSafari) {
// firefox & safari doesn't support device orientation sensor
+ setAlert.set({
+ variant: 'warning',
+ message: "Unable to handle device orientation. Your browser doesn't support device orientation sensors.",
+ });
} else {
// See the API specification at: https://w3c.github.io/orientation-sensor
// We use referenceFrame: 'screen' because the web page will rotate when
diff --git a/src/mapper/src/store/common.ts b/src/mapper/src/store/common.ts
new file mode 100644
index 000000000..a191f81dc
--- /dev/null
+++ b/src/mapper/src/store/common.ts
@@ -0,0 +1,6 @@
+import { writable } from 'svelte/store';
+
+export const setAlert = writable({
+ variant: '',
+ message: '',
+});
diff --git a/src/mapper/static/assets/icons/exclamation-octagon.svg b/src/mapper/static/assets/icons/exclamation-octagon.svg
new file mode 100644
index 000000000..7f2593813
--- /dev/null
+++ b/src/mapper/static/assets/icons/exclamation-octagon.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/src/mapper/static/assets/icons/exclamation-triangle.svg b/src/mapper/static/assets/icons/exclamation-triangle.svg
new file mode 100644
index 000000000..506b7774a
--- /dev/null
+++ b/src/mapper/static/assets/icons/exclamation-triangle.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/src/mapper/static/assets/icons/info-circle.svg b/src/mapper/static/assets/icons/info-circle.svg
new file mode 100644
index 000000000..e2b50eb5f
--- /dev/null
+++ b/src/mapper/static/assets/icons/info-circle.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/src/mapper/vite.config.ts b/src/mapper/vite.config.ts
index e70837c6a..fc8f8bb81 100644
--- a/src/mapper/vite.config.ts
+++ b/src/mapper/vite.config.ts
@@ -23,6 +23,10 @@ export default defineConfig({
$lib: path.resolve('./src/lib'),
$components: path.resolve('./src/components'),
$static: path.resolve('./static'),
+ $store: path.resolve('./src/store'),
+ $styles: path.resolve('./src/styles'),
+ $assets: path.resolve('./src/assets'),
+ $utilFunctions: path.resolve('./src/utilFunctions'),
},
},
test: {
From 90fb1a8380159f6adae5cb6de1b794eb4ba3b093 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 21 Oct 2024 20:00:14 +0100
Subject: [PATCH 2/2] [pre-commit.ci] pre-commit autoupdate (#1831)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.7.0)
- [github.com/sqlfluff/sqlfluff: 3.2.3 → 3.2.4](https://github.com/sqlfluff/sqlfluff/compare/3.2.3...3.2.4)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
---
.pre-commit-config.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 946efbfa6..ab780c9d7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -9,7 +9,7 @@ repos:
# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
- rev: "v0.6.9"
+ rev: "v0.7.0"
hooks:
# Run the linter
- id: ruff
@@ -73,7 +73,7 @@ repos:
# Lint & Autoformat: SQL
- repo: https://github.com/sqlfluff/sqlfluff
- rev: 3.2.3
+ rev: 3.2.4
hooks:
- id: sqlfluff-lint
files: ^src/backend/migrations/.*\.sql$