From 89382a497c6ddd8cf24ac737762ae40a970a551e Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 2 Jul 2024 10:07:54 +0200 Subject: [PATCH] using markdown for docs --- website/package-lock.json | 64 ++++++++++++++++++ website/package.json | 1 + website/src/lib/components/Footer.svelte | 17 +++++ website/src/lib/components/Logo.svelte | 1 - website/src/lib/components/MapboxLogo.svelte | 12 ++++ website/src/lib/components/Nav.svelte | 67 +++++++++++++++++++ website/src/lib/components/docs/Docs.svx | 9 +++ .../src/lib/components/docs/DocsLoader.svelte | 19 ++++++ website/src/lib/docs/en/about.svx | 33 +++++++++ website/src/lib/docs/en/introduction/test.md | 0 website/src/lib/languages.ts | 2 +- website/src/locales/en.json | 2 + .../src/routes/[...language]/+layout.svelte | 45 ++++++++++++- .../routes/[...language]/about/+page.svelte | 5 ++ .../[...language]/documentation/+page.svelte | 5 ++ website/static/mapbox-logo-black.svg | 38 +++++++++++ website/static/mapbox-logo-white.svg | 42 ++++++++++++ website/svelte.config.js | 9 ++- 18 files changed, 366 insertions(+), 5 deletions(-) create mode 100644 website/src/lib/components/Footer.svelte create mode 100644 website/src/lib/components/MapboxLogo.svelte create mode 100644 website/src/lib/components/Nav.svelte create mode 100644 website/src/lib/components/docs/Docs.svx create mode 100644 website/src/lib/components/docs/DocsLoader.svelte create mode 100644 website/src/lib/docs/en/about.svx create mode 100644 website/src/lib/docs/en/introduction/test.md create mode 100644 website/src/routes/[...language]/documentation/+page.svelte create mode 100644 website/static/mapbox-logo-black.svg create mode 100644 website/static/mapbox-logo-white.svg diff --git a/website/package-lock.json b/website/package-lock.json index 5bc8b8ad..8a1c173f 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -44,6 +44,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.40.0", "events": "^3.3.0", + "mdsvex": "^0.11.2", "postcss": "^8.4.38", "prettier": "^3.3.2", "prettier-plugin-svelte": "^3.2.4", @@ -1532,6 +1533,12 @@ "resolved": "https://registry.npmjs.org/@types/three/-/three-0.134.0.tgz", "integrity": "sha512-4YB+99Rgqq27EjiYTItEoZtdjLnTh8W9LxowgpC9eWsjaQJIL4Kn/ZcUKAnW3gB/jS4hqGN8iqmid+RcUZDzpA==" }, + "node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", + "dev": true + }, "node_modules/@types/virtual-dom": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@types/virtual-dom/-/virtual-dom-2.1.4.tgz", @@ -3931,6 +3938,21 @@ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==" }, + "node_modules/mdsvex": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.11.2.tgz", + "integrity": "sha512-Y4ab+vLvTJS88196Scb/RFNaHMHVSWw6CwfsgWIQP8f42D57iDII0/qABSu530V4pkv8s6T2nx3ds0MC1VwFLA==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.3", + "prism-svelte": "^0.4.7", + "prismjs": "^1.17.1", + "vfile-message": "^2.0.4" + }, + "peerDependencies": { + "svelte": "^3.56.0 || ^4.0.0 || ^5.0.0-next.120" + } + }, "node_modules/memoizee": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", @@ -4674,6 +4696,21 @@ "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" } }, + "node_modules/prism-svelte": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/prism-svelte/-/prism-svelte-0.4.7.tgz", + "integrity": "sha512-yABh19CYbM24V7aS7TuPYRNMqthxwbvx6FF/Rw920YbyBWO3tnyPIqRMgHuSVsLmuHkkBS1Akyof463FVdkeDQ==", + "dev": true + }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -6299,6 +6336,19 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, + "node_modules/unist-util-stringify-position": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -6352,6 +6402,20 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/vfile-message": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz", + "integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/virtual-dom": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/virtual-dom/-/virtual-dom-2.1.1.tgz", diff --git a/website/package.json b/website/package.json index 33265909..e91c2ec0 100644 --- a/website/package.json +++ b/website/package.json @@ -30,6 +30,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.40.0", "events": "^3.3.0", + "mdsvex": "^0.11.2", "postcss": "^8.4.38", "prettier": "^3.3.2", "prettier-plugin-svelte": "^3.2.4", diff --git a/website/src/lib/components/Footer.svelte b/website/src/lib/components/Footer.svelte new file mode 100644 index 00000000..d0f4cda4 --- /dev/null +++ b/website/src/lib/components/Footer.svelte @@ -0,0 +1,17 @@ + + + diff --git a/website/src/lib/components/Logo.svelte b/website/src/lib/components/Logo.svelte index 9833a15b..076b863e 100644 --- a/website/src/lib/components/Logo.svelte +++ b/website/src/lib/components/Logo.svelte @@ -1,6 +1,5 @@ + + + Logo of Mapbox. + diff --git a/website/src/lib/components/Nav.svelte b/website/src/lib/components/Nav.svelte new file mode 100644 index 00000000..41db8bd7 --- /dev/null +++ b/website/src/lib/components/Nav.svelte @@ -0,0 +1,67 @@ + + + diff --git a/website/src/lib/components/docs/Docs.svx b/website/src/lib/components/docs/Docs.svx new file mode 100644 index 00000000..e134bd2c --- /dev/null +++ b/website/src/lib/components/docs/Docs.svx @@ -0,0 +1,9 @@ + + + diff --git a/website/src/lib/components/docs/DocsLoader.svelte b/website/src/lib/components/docs/DocsLoader.svelte new file mode 100644 index 00000000..8ec82365 --- /dev/null +++ b/website/src/lib/components/docs/DocsLoader.svelte @@ -0,0 +1,19 @@ + + +{#if module !== undefined} + +{/if} diff --git a/website/src/lib/docs/en/about.svx b/website/src/lib/docs/en/about.svx new file mode 100644 index 00000000..6adb0bf0 --- /dev/null +++ b/website/src/lib/docs/en/about.svx @@ -0,0 +1,33 @@ + + + +**gpx.studio** is a *free* and *open-source* online GPX viewer and editor which allows to: +- visualize multiple traces in different colors and aided by many different maps (cycling, hiking, satellite, etc.) +- edit traces by adding, inserting, moving or deleting track points +- reverse traces +- add or change the timestamps of a trace +- view, add, edit and remove waypoints +- reduce the number of track points +- view and rework the structure of the file +- automatically add elevation data to traces if missing +- merge multiple traces, extending time, heart rate, cadence, power and temperature data where needed +- extract segments from traces and perform any other action while maintaining the segments' structure within files +- save the result on your computer or to your Google Drive™ to get a shareable link and embedding code + +## Mapbox Community 🤝 + +[Mapbox](https://mapbox.com) is the company providing some of the beautiful maps on this website. They created a program called [Mapbox Community](https://www.mapbox.com/community) to support non-profits, educational institutions, and positive-impact organizations. We are very lucky and grateful to have joined this program and to benefit from a great discount on all API rates. + + + +## Help keep the website free (and ad-free) 🙏 + +Each time you add or move a track point, we make a request to our servers to retrieve a route on the road network. We also rely on APIs from Mapbox to load beautiful maps, retrieve elevation data and process geocoding requests (looking for a place in the search bar). + +Unfortunately this is very costly so if you like the tool and use it frequently, please consider making even a small donation so that this website can stay free to use and ad-free. Thanks for your support! + +## Translating 🗣 + +The website is translated by volunteers on a collaborative translation platform. You can help complete and improve the translations by joining the [Crowdin project](https://crowdin.com/project/gpxstudio). [Get in touch](#contact) if you would like to start the translation in a new language. Any help is greatly appreciated! \ No newline at end of file diff --git a/website/src/lib/docs/en/introduction/test.md b/website/src/lib/docs/en/introduction/test.md new file mode 100644 index 00000000..e69de29b diff --git a/website/src/lib/languages.ts b/website/src/lib/languages.ts index a3e24e4a..cccbd8db 100644 --- a/website/src/lib/languages.ts +++ b/website/src/lib/languages.ts @@ -1,3 +1,3 @@ -export const languages = { +export const languages: Record = { 'en': 'English', }; \ No newline at end of file diff --git a/website/src/locales/en.json b/website/src/locales/en.json index d0c400f6..e2afbf18 100644 --- a/website/src/locales/en.json +++ b/website/src/locales/en.json @@ -52,8 +52,10 @@ "layers": "Map layers...", "distance_markers": "Distance markers", "direction_markers": "Direction markers", + "app": "App", "about": "About", "donate": "Donate", + "documentation": "Documentation", "ctrl": "Ctrl", "click": "Click", "drag": "Drag", diff --git a/website/src/routes/[...language]/+layout.svelte b/website/src/routes/[...language]/+layout.svelte index e90ea297..ac73762d 100644 --- a/website/src/routes/[...language]/+layout.svelte +++ b/website/src/routes/[...language]/+layout.svelte @@ -2,14 +2,55 @@ import { ModeWatcher } from 'mode-watcher'; import { isLoading, locale, _ } from 'svelte-i18n'; import { page } from '$app/stores'; + import Nav from '$lib/components/Nav.svelte'; + import Footer from '$lib/components/Footer.svelte'; - if ($page.params.language) { + $: if ($page.params.language === '' && $locale !== 'en') { + locale.set('en'); + } else if ($page.params.language && $locale !== $page.params.language) { locale.set($page.params.language); } + + const appRoute = '/[...language]'; {#if !$isLoading} - + {#if $page.route.id === appRoute} + + {:else} +