Formatting/Linting

This commit is contained in:
Nicolai Ort 2021-08-16 18:27:09 +02:00
parent c4e1b5e445
commit 08520ac616
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
12 changed files with 422 additions and 415 deletions

View File

@ -1,2 +1,3 @@
# LinkyLinky Extension
> The companion extension for LinkyLinky

View File

@ -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"
}
"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"
}
}

View File

@ -1,20 +1,21 @@
const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");
const cssnano = require("cssnano");
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const mode = process.env.NODE_ENV;
const dev = mode === "development";
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",
})
],
//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;

View File

@ -1,4 +1,4 @@
@tailwind base;
/* Write your global styles here, in PostCSS syntax */
@tailwind components;
@tailwind utilities
@tailwind utilities;

View File

@ -1,30 +1,38 @@
import axios from 'axios';
const config = {
username: "niggl",
password: "niggl"
}
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 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 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 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
}
static async deleteUrl(shortcode) {
return (
await axios.delete(`https://kauft.es/api/${shortcode}`, {
auth: config
})
).status;
}
}

View File

@ -1,15 +1,14 @@
<script>
export let title = 'Title';
export let count = 0;
export let title = 'Title';
export let count = 0;
</script>
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-900">
<div
class="p-3 mr-4 text-red-500 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-500"
>
<slot></slot>
</div>
<div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p>
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200">{count}</p>
</div>
<div class="p-3 mr-4 text-red-500 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-500">
<slot />
</div>
<div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p>
<p class="text-lg font-semibold text-gray-700 dark:text-gray-200">{count}</p>
</div>
</div>

View File

@ -6,7 +6,7 @@
});
function deleteUrl(shortcode) {
Apiclient.deleteUrl(shortcode).then((res) => {
Apiclient.deleteUrl(shortcode).then(() => {
urls = urls.filter((url) => url.shortcode != shortcode);
});
}
@ -63,18 +63,18 @@
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm"> {url.visits} </td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button
on:click={deleteUrl(url.shortcode)}
class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-red-600 rounded-md hover:bg-red-700 focus:outline-none focus:bg-red-700"
<button
on:click={deleteUrl(url.shortcode)}
class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-red-600 rounded-md hover:bg-red-700 focus:outline-none focus:bg-red-700"
>
Delete
</button>
<a
href={`/details?shortcode=${url.shortcode}`}
class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:bg-blue-700"
>
Details
</a>
Delete
</button>
<a
href={`/details?shortcode=${url.shortcode}`}
class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:bg-blue-700"
>
Details
</a>
</td>
</tr>
{/each}

View File

@ -1,20 +1,22 @@
import preprocess from "svelte-preprocess";
import preprocess from 'svelte-preprocess';
import staticAdapter from '@sveltejs/adapter-static';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
kit: {
// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte',
adapter: staticAdapter(),
adapter: staticAdapter(),
files: {
assets: 'static'
}
},
preprocess: [preprocess({
"postcss": true
})]
preprocess: [
preprocess({
postcss: true
})
]
};
export default config;

View File

@ -1,13 +1,11 @@
const config = {
mode: "jit",
mode: 'jit',
darkMode: 'media',
purge: [
"./src/**/*.{html,js,svelte,ts}",
],
purge: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {},
extend: {}
},
plugins: [],
plugins: []
};
module.exports = config;