From 503401ff57208dc42774528a4824dfefc5d42e9c Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 15 Jun 2021 00:08:07 +0200 Subject: [PATCH] Rewrite frontend using Vue --- frontend/App.vue | 723 +++++++++++++++++++++++++++++++++++++++++ frontend/index.js | 7 + package.json | 22 ++ snowpack.config.mjs | 35 ++ templates/map.html | 89 +---- templates/old_map.html | 88 +++++ web_view.py | 20 +- 7 files changed, 908 insertions(+), 76 deletions(-) create mode 100644 frontend/App.vue create mode 100644 frontend/index.js create mode 100644 package.json create mode 100644 snowpack.config.mjs create mode 100644 templates/old_map.html diff --git a/frontend/App.vue b/frontend/App.vue new file mode 100644 index 0000000..0a1923d --- /dev/null +++ b/frontend/App.vue @@ -0,0 +1,723 @@ + + + + + diff --git a/frontend/index.js b/frontend/index.js new file mode 100644 index 0000000..c3a35df --- /dev/null +++ b/frontend/index.js @@ -0,0 +1,7 @@ +import {createApp} from 'vue'; +import App from './App.vue'; + +export default function(props) { + const app = createApp(App, props).mount('#app'); + return app; +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2e463cc --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "type": "module", + "scripts": { + "start": "NODE_OPTIONS='--experimental-json-modules' snowpack dev", + "build": "NODE_OPTIONS='--experimental-json-modules' snowpack build", + "test": "echo \"This template does not include a test runner by default.\" && exit 1" + }, + "dependencies": { + "bootstrap": "^5.0.1", + "fork-awesome": "^1.1.7", + "leaflet": "^1.7.1", + "leaflet-extra-markers": "^1.2.1", + "redaxios": "^0.4.1", + "vue": "^3.0.11" + }, + "devDependencies": { + "@snowpack/plugin-dotenv": "^2.1.0", + "@snowpack/plugin-vue": "^2.4.0", + "snowpack": "^3.3.7", + "snowpack-plugin-cdn-import": "^1.0.0" + } +} diff --git a/snowpack.config.mjs b/snowpack.config.mjs new file mode 100644 index 0000000..f92da73 --- /dev/null +++ b/snowpack.config.mjs @@ -0,0 +1,35 @@ +import pkg from './package.json'; + +/** @type {import("snowpack").SnowpackUserConfig } */ +export default { + mount: { + // public: {url: '/', static: true}, + frontend: {url: '/dist'}, + }, + plugins: [ + '@snowpack/plugin-vue', + '@snowpack/plugin-dotenv', + ['snowpack-plugin-cdn-import', { + dependencies: pkg.dependencies, + enableInDevMode: true, + // baseUrl: 'https://unpkg.com', + }] + ], + routes: [ + /* Enable an SPA Fallback in development: */ + // {"match": "routes", "src": ".*", "dest": "/index.html"}, + ], + optimize: { + /* Example: Bundle your final build: */ + // "bundle": true, + }, + packageOptions: { + /* ... */ + }, + devOptions: { + /* ... */ + }, + buildOptions: { + /* ... */ + }, +}; diff --git a/templates/map.html b/templates/map.html index c23d12d..8ff72cd 100644 --- a/templates/map.html +++ b/templates/map.html @@ -2,87 +2,28 @@ - Map showing Wikidata items linked to OSM - - + + Wikidata items linked to OSM + - - + + -
-
- +
-