From 08520ac61638df3b81aed95260bd52c710fb2dfc Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Mon, 16 Aug 2021 18:27:09 +0200 Subject: [PATCH] Formatting/Linting --- README.md | 1 + manifest.json | 24 ++- postcss.config.cjs | 41 ++--- src/app.postcss | 2 +- src/lib/Apiclient.js | 68 +++++---- src/lib/Sidebar.svelte | 304 +++++++++++++++++++------------------- src/lib/Statscard.svelte | 29 ++-- src/routes/details.svelte | 132 ++++++++--------- src/routes/index.svelte | 2 +- src/routes/links.svelte | 168 ++++++++++----------- svelte.config.js | 42 +++--- tailwind.config.cjs | 24 ++- 12 files changed, 422 insertions(+), 415 deletions(-) diff --git a/README.md b/README.md index 14af788..3a7b6b9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # LinkyLinky Extension + > The companion extension for LinkyLinky diff --git a/manifest.json b/manifest.json index 384d274..2cd8ca3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,13 +1,11 @@ -{ - "manifest_version": 2, - "name": "LinkyLinky", - "version": "0.0.1", - "description": "A simple url shortener", - "short_name": "LinkyLinky", - "permissions": [ - "activeTab" - ], - "browser_action": { - "default_popup": "build/index.html" - } -} \ No newline at end of file +{ + "manifest_version": 2, + "name": "LinkyLinky", + "version": "0.0.1", + "description": "A simple url shortener", + "short_name": "LinkyLinky", + "permissions": ["activeTab"], + "browser_action": { + "default_popup": "build/index.html" + } +} diff --git a/postcss.config.cjs b/postcss.config.cjs index 530f2fc..1b38954 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -1,20 +1,21 @@ -const tailwindcss = require("tailwindcss"); -const autoprefixer = require("autoprefixer"); -const cssnano = require("cssnano"); - -const mode = process.env.NODE_ENV; -const dev = mode === "development"; - -const config = { - plugins: [ - //Some plugins, like postcss-nested, need to run before Tailwind, - tailwindcss(), - //But others, like autoprefixer, need to run after, - autoprefixer(), - !dev && cssnano({ - preset: "default", - }) - ], -}; - -module.exports = config; \ No newline at end of file +const tailwindcss = require('tailwindcss'); +const autoprefixer = require('autoprefixer'); +const cssnano = require('cssnano'); + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = { + plugins: [ + //Some plugins, like postcss-nested, need to run before Tailwind, + tailwindcss(), + //But others, like autoprefixer, need to run after, + autoprefixer(), + !dev && + cssnano({ + preset: 'default' + }) + ] +}; + +module.exports = config; diff --git a/src/app.postcss b/src/app.postcss index dbf6827..e27e67f 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -1,4 +1,4 @@ @tailwind base; /* Write your global styles here, in PostCSS syntax */ @tailwind components; -@tailwind utilities \ No newline at end of file +@tailwind utilities; diff --git a/src/lib/Apiclient.js b/src/lib/Apiclient.js index f4c7be7..9f1497e 100644 --- a/src/lib/Apiclient.js +++ b/src/lib/Apiclient.js @@ -1,30 +1,38 @@ -import axios from 'axios'; -const config = { - username: "niggl", - password: "niggl" -} -export default class Apiclient { - static async getUrls() { - return (await axios.get("https://kauft.es/api?showVisits=true", { - auth: config - })).data - } - - static async getUrlDetails(shortcode) { - return (await axios.get(`https://kauft.es/api/${shortcode}`, { - auth: config - })).data - } - - static async getUrlVisits(shortcode) { - return (await axios.get(`https://kauft.es/api/${shortcode}/visits`, { - auth: config - })).data - } - - static async deleteUrl(shortcode) { - return (await axios.delete(`https://kauft.es/api/${shortcode}`, { - auth: config - })).status - } -} \ No newline at end of file +import axios from 'axios'; +const config = { + username: 'niggl', + password: '9VEBc596T7tiPB7mNJukfeH9LfGzrrJN' +}; +export default class Apiclient { + static async getUrls() { + return ( + await axios.get('https://kauft.es/api?showVisits=true', { + auth: config + }) + ).data; + } + + static async getUrlDetails(shortcode) { + return ( + await axios.get(`https://kauft.es/api/${shortcode}`, { + auth: config + }) + ).data; + } + + static async getUrlVisits(shortcode) { + return ( + await axios.get(`https://kauft.es/api/${shortcode}/visits`, { + auth: config + }) + ).data; + } + + static async deleteUrl(shortcode) { + return ( + await axios.delete(`https://kauft.es/api/${shortcode}`, { + auth: config + }) + ).status; + } +} diff --git a/src/lib/Sidebar.svelte b/src/lib/Sidebar.svelte index 2f9b5de..4e2960a 100644 --- a/src/lib/Sidebar.svelte +++ b/src/lib/Sidebar.svelte @@ -1,152 +1,152 @@ - - -
-

LinkyLinky

- -
- - - - - - - -
- -
- - -
- avatar -

John Doe

-
-
-
+ + +
+

LinkyLinky

+ +
+ + + + + + + +
+ +
+ + +
+ avatar +

John Doe

+
+
+
diff --git a/src/lib/Statscard.svelte b/src/lib/Statscard.svelte index bc9176a..9ee64e8 100644 --- a/src/lib/Statscard.svelte +++ b/src/lib/Statscard.svelte @@ -1,15 +1,14 @@ - -
-
- -
-
-

{title}

-

{count}

-
-
\ No newline at end of file + + +
+
+ +
+
+

{title}

+

{count}

+
+
diff --git a/src/routes/details.svelte b/src/routes/details.svelte index 5e22b01..13a5c1c 100644 --- a/src/routes/details.svelte +++ b/src/routes/details.svelte @@ -1,66 +1,66 @@ - - -

Details: {shortcode}

- -
- Shortcode: - {urlDetails.shortcode}
- URL: - {urlDetails.url}
- Target: - {urlDetails.target}
- Visits: - {urlDetails.visits} -
- -
- - - - - - - - {#await visitQuery} - - - - {:then} - {#each urlVisists as visit} - - - - {/each} - {/await} - -
- Timestamp -
- Loading data... -
- {visit.timestamp} -
-
+ + +

Details: {shortcode}

+ +
+ Shortcode: + {urlDetails.shortcode}
+ URL: + {urlDetails.url}
+ Target: + {urlDetails.target}
+ Visits: + {urlDetails.visits} +
+ +
+ + + + + + + + {#await visitQuery} + + + + {:then} + {#each urlVisists as visit} + + + + {/each} + {/await} + +
+ Timestamp +
+ Loading data... +
+ {visit.timestamp} +
+
diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 075a251..371625a 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -36,4 +36,4 @@ /> - \ No newline at end of file + diff --git a/src/routes/links.svelte b/src/routes/links.svelte index bec083b..73c00b8 100644 --- a/src/routes/links.svelte +++ b/src/routes/links.svelte @@ -1,84 +1,84 @@ - - -

Manage all links

-
- - - - - - - - - - - {#await urlQuery} - - - - - - - {:then} - {#each urls as url} - - - - - - - {/each} - {/await} - -
- Shortcode - - Target - - Visits - - Edit -
- Loading data... - - Loading data... - Loading data... - -
- {url.shortcode} - - {url.target} - {url.visits} - - - Details - -
-
+ + +

Manage all links

+
+ + + + + + + + + + + {#await urlQuery} + + + + + + + {:then} + {#each urls as url} + + + + + + + {/each} + {/await} + +
+ Shortcode + + Target + + Visits + + Edit +
+ Loading data... + + Loading data... + Loading data... + +
+ {url.shortcode} + + {url.target} + {url.visits} + + + Details + +
+
diff --git a/svelte.config.js b/svelte.config.js index 48483c8..0f3c8ae 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,20 +1,22 @@ -import preprocess from "svelte-preprocess"; -import staticAdapter from '@sveltejs/adapter-static'; - -/** @type {import('@sveltejs/kit').Config} */ -const config = { - kit: { - // hydrate the
element in src/app.html - target: '#svelte', - adapter: staticAdapter(), - files: { - assets: 'static' - } - }, - - preprocess: [preprocess({ - "postcss": true - })] -}; - -export default config; +import preprocess from 'svelte-preprocess'; +import staticAdapter from '@sveltejs/adapter-static'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + kit: { + // hydrate the
element in src/app.html + target: '#svelte', + adapter: staticAdapter(), + files: { + assets: 'static' + } + }, + + preprocess: [ + preprocess({ + postcss: true + }) + ] +}; + +export default config; diff --git a/tailwind.config.cjs b/tailwind.config.cjs index cbad218..4c7fdd0 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -1,13 +1,11 @@ -const config = { - mode: "jit", - darkMode: 'media', - purge: [ - "./src/**/*.{html,js,svelte,ts}", - ], - theme: { - extend: {}, - }, - plugins: [], -}; - -module.exports = config; +const config = { + mode: 'jit', + darkMode: 'media', + purge: ['./src/**/*.{html,js,svelte,ts}'], + theme: { + extend: {} + }, + plugins: [] +}; + +module.exports = config;