From 92acb52aac5ba99268745b19756c281fdf722793 Mon Sep 17 00:00:00 2001 From: ditatompel Date: Sat, 4 May 2024 15:32:42 +0700 Subject: [PATCH] Adding my old frontpage UI to this project --- frontend/src/lib/components/Footer.svelte | 43 +++ .../lib/components/navigation/MainNav.svelte | 72 +++++ .../components/navigation/MobileDrawer.svelte | 28 ++ .../src/lib/components/navigation/index.js | 2 + frontend/src/lib/utils/arrays.js | 17 ++ frontend/src/routes/(front)/+layout.svelte | 210 +++++++++++++ frontend/src/routes/{ => (front)}/+page.js | 0 .../src/routes/{ => (front)}/+page.svelte | 4 +- frontend/src/routes/(front)/add-node/+page.js | 27 ++ .../src/routes/(front)/add-node/+page.svelte | 115 ++++++++ .../src/routes/(front)/remote-nodes/+page.js | 27 ++ .../routes/(front)/remote-nodes/+page.svelte | 275 ++++++++++++++++++ .../(front)/remote-nodes/api-handler.js | 22 ++ .../components/CountryCellWithAsn.svelte | 38 +++ .../components/EstimateFeeCell.svelte | 10 + .../components/HostPortCell.svelte | 47 +++ .../components/NetTypeCell.svelte | 15 + .../components/ProtocolCell.svelte | 16 + .../components/SelectAnonymityFilter.svelte | 20 ++ .../components/SelectFilter.svelte | 22 ++ .../components/SelectStatusFilter.svelte | 20 ++ .../remote-nodes/components/StatusCell.svelte | 20 ++ .../remote-nodes/components/UptimeCell.svelte | 13 + .../(front)/remote-nodes/components/index.js | 10 + frontend/src/routes/+layout.svelte | 12 +- 25 files changed, 1078 insertions(+), 7 deletions(-) create mode 100644 frontend/src/lib/components/Footer.svelte create mode 100644 frontend/src/lib/components/navigation/MainNav.svelte create mode 100644 frontend/src/lib/components/navigation/MobileDrawer.svelte create mode 100644 frontend/src/lib/utils/arrays.js create mode 100644 frontend/src/routes/(front)/+layout.svelte rename frontend/src/routes/{ => (front)}/+page.js (100%) rename frontend/src/routes/{ => (front)}/+page.svelte (99%) create mode 100644 frontend/src/routes/(front)/add-node/+page.js create mode 100644 frontend/src/routes/(front)/add-node/+page.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/+page.js create mode 100644 frontend/src/routes/(front)/remote-nodes/+page.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/api-handler.js create mode 100644 frontend/src/routes/(front)/remote-nodes/components/CountryCellWithAsn.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/EstimateFeeCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/HostPortCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/NetTypeCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/ProtocolCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/SelectAnonymityFilter.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/SelectFilter.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/SelectStatusFilter.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/StatusCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/UptimeCell.svelte create mode 100644 frontend/src/routes/(front)/remote-nodes/components/index.js diff --git a/frontend/src/lib/components/Footer.svelte b/frontend/src/lib/components/Footer.svelte new file mode 100644 index 0000000..5d5f914 --- /dev/null +++ b/frontend/src/lib/components/Footer.svelte @@ -0,0 +1,43 @@ + + +
+ +
diff --git a/frontend/src/lib/components/navigation/MainNav.svelte b/frontend/src/lib/components/navigation/MainNav.svelte new file mode 100644 index 0000000..bfd13fd --- /dev/null +++ b/frontend/src/lib/components/navigation/MainNav.svelte @@ -0,0 +1,72 @@ + + + + + diff --git a/frontend/src/lib/components/navigation/MobileDrawer.svelte b/frontend/src/lib/components/navigation/MobileDrawer.svelte new file mode 100644 index 0000000..46dbae2 --- /dev/null +++ b/frontend/src/lib/components/navigation/MobileDrawer.svelte @@ -0,0 +1,28 @@ + + + diff --git a/frontend/src/lib/components/navigation/index.js b/frontend/src/lib/components/navigation/index.js index 4eef507..60e85f8 100644 --- a/frontend/src/lib/components/navigation/index.js +++ b/frontend/src/lib/components/navigation/index.js @@ -1,3 +1,5 @@ +export { default as MainNav } from './MainNav.svelte'; +export { default as MobileDrawer } from './MobileDrawer.svelte'; export { default as AdminNav } from './AdminNav.svelte'; export { default as AdminSidebar } from './AdminSidebar.svelte'; export { default as AdminMobileDrawer } from './AdminMobileDrawer.svelte'; diff --git a/frontend/src/lib/utils/arrays.js b/frontend/src/lib/utils/arrays.js new file mode 100644 index 0000000..ca73811 --- /dev/null +++ b/frontend/src/lib/utils/arrays.js @@ -0,0 +1,17 @@ +export const getDistinct = (items) => { + return Array.from(getCounter(items).keys()); +}; + +export const getDuplicates = (items) => { + return Array.from(getCounter(items).entries()) + .filter(([, count]) => count !== 1) + .map(([key]) => key); +}; + +export const getCounter = (items) => { + const result = new Map(); + items.forEach((item) => { + result.set(item, (result.get(item) ?? 0) + 1); + }); + return result; +}; diff --git a/frontend/src/routes/(front)/+layout.svelte b/frontend/src/routes/(front)/+layout.svelte new file mode 100644 index 0000000..dd1d263 --- /dev/null +++ b/frontend/src/routes/(front)/+layout.svelte @@ -0,0 +1,210 @@ + + + + {meta.title} — xmr.ditatompel.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Navigation

+
+ +
+
+ + + + + + + + + + + + + +
+ +
+ +