Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DTTerastar committed Dec 29, 2024
1 parent 7c6f6dc commit 753b480
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 125 deletions.
30 changes: 0 additions & 30 deletions src/ui/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/ui/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@
"track",
"width"
]
}
}
67 changes: 30 additions & 37 deletions src/ui/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginSvelte from "eslint-plugin-svelte";
import globals from "globals";
import tsEslint from "typescript-eslint";
import vitest from "eslint-plugin-vitest";
import playwright from "eslint-plugin-playwright";
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginSvelte from 'eslint-plugin-svelte';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
import vitest from 'eslint-plugin-vitest';
import playwright from 'eslint-plugin-playwright';

export default [
js.configs.recommended,
...tsEslint.configs.recommended,
...eslintPluginSvelte.configs["flat/recommended"],
eslintConfigPrettier,
{
...playwright.configs["flat/playwright"],
files: ["tests/**"]
},
vitest.configs.recommended,
...eslintPluginSvelte.configs["flat/prettier"],
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: { ...globals.node, ...globals.browser },
parserOptions: {
extraFileExtensions: [".svelte"]
}
}
},
{
ignores: [
".svelte-kit",
"build",
"package",
"coverage",
"node_modules",
"playwright.config.js"
]
}
js.configs.recommended,
...tsEslint.configs.recommended,
...eslintPluginSvelte.configs['flat/recommended'],
eslintConfigPrettier,
{
...playwright.configs['flat/playwright'],
files: ['tests/**']
},
vitest.configs.recommended,
...eslintPluginSvelte.configs['flat/prettier'],
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: { ...globals.node, ...globals.browser },
parserOptions: {
extraFileExtensions: ['.svelte']
}
}
},
{
ignores: ['.svelte-kit', 'build', 'package', 'coverage', 'node_modules', 'playwright.config.js']
}
];
11 changes: 0 additions & 11 deletions src/ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@sveltejs/kit": "^2.15.1",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@tailwindcss/forms": "^0.5.9",
"@types/cookie": "^1.0.0",
"@types/d3": "^7.4.3",
"@types/node": "^22.9.1",
"@typescript-eslint/eslint-plugin": "^8.15.0",
Expand Down
6 changes: 3 additions & 3 deletions src/ui/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
autoprefixer: {}
}
};
5 changes: 4 additions & 1 deletion src/ui/src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
@tailwind variants;

/*place global styles here */
html, body { @apply h-full overflow-hidden; }
html,
body {
@apply h-full overflow-hidden;
}
2 changes: 1 addition & 1 deletion src/ui/src/lib/DevicesTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{ key: 'fixes', title: 'Fixes', value: (d) => d.fixes ?? 'n/a', sortable: true },
{ key: 'scale', title: 'Scale', value: (d) => d.scale?.toFixed(3) ?? 'n/a', sortable: true },
{ key: 'confidence', title: 'Confidence', value: (d) => d.confidence ?? 'n/a', sortable: true },
{ key: 'lastHit', title: 'LastHit', value: (d) => ((d.lastHit ?? '') == '' ? 'n/a' : ago(new Date(d.lastHit)) ?? 'n/a'), sortable: true }
{ key: 'lastHit', title: 'LastHit', value: (d) => ((d.lastHit ?? '') == '' ? 'n/a' : (ago(new Date(d.lastHit)) ?? 'n/a')), sortable: true }
];
function onRowClick(e) {
Expand Down
16 changes: 5 additions & 11 deletions src/ui/src/lib/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
const handler = zoom()
.scaleExtent([0.5, 40])
.wheelDelta((event) => { return -(event.deltaY + event.deltaX * 0.25) * 0.002; })
.wheelDelta((event) => {
return -(event.deltaY + event.deltaX * 0.25) * 0.002;
})
.on('zoom', (e) => {
transform = e.transform;
});
Expand All @@ -52,12 +54,11 @@
}
function handleKeyboard(event: KeyboardEvent) {
const zoomFactor = event.shiftKey ? 1.005 : 1.1;
const translateAmount = event.shiftKey ? 1 : 50;
let newTransform = transform;
switch(event.key) {
switch (event.key) {
case '0':
event.preventDefault();
newTransform = zoomIdentity.translate(transform.x, transform.y);
Expand Down Expand Up @@ -117,14 +118,7 @@
<svelte:window on:keydown={handleKeyboard} />

{#if bounds}
<LayerCake
x="0"
y="1"
xRange={getXRange}
yRange={getYRange}
flatData={squareBounds}
padding={{ top: 16, left: 16, bottom: 16, right: 16 }}
>
<LayerCake x="0" y="1" xRange={getXRange} yRange={getYRange} flatData={squareBounds} padding={{ top: 16, left: 16, bottom: 16, right: 16 }}>
<Svg bind:element={svg}>
<MapCoordinates {transform} />
<AxisX {transform} />
Expand Down
28 changes: 14 additions & 14 deletions src/ui/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte'],
extensions: ['.svelte'],

preprocess: [vitePreprocess()],
preprocess: [vitePreprocess()],

relative: true,
relative: true,

vitePlugin: {
inspector: true,
},
inspector: true
},

kit: {
embedded: true,
inlineStyleThreshold: 4096,
kit: {
embedded: true,
inlineStyleThreshold: 4096,
prerender: {
crawl: false
},
},
adapter: adapter({
strict: false
}),
version: {
name: child_process.execSync('git rev-parse HEAD').toString().trim(),
pollInterval: 5000
},
}),
version: {
name: child_process.execSync('git rev-parse HEAD').toString().trim(),
pollInterval: 5000
}
}
};

Expand Down
23 changes: 10 additions & 13 deletions src/ui/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ const config = {
content: [
'./src/**/*.{html,js,svelte,ts}',
// 3. Append the path to the Skeleton package
join(require.resolve(
'@skeletonlabs/skeleton'),
'../**/*.{html,js,svelte,ts}'
)
join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')
],
theme: {
extend: {},
extend: {}
},
plugins: [
forms,
Expand All @@ -23,16 +20,16 @@ const config = {
preset: [
{
name: 'skeleton',
enhancements: true,
enhancements: true
},
{
name: 'crimson',
enhancements: true,
},
],
},
}),
],
enhancements: true
}
]
}
})
]
} satisfies Config;

export default config;
export default config;
4 changes: 2 additions & 2 deletions src/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default defineConfig({
'/ws': {
target: 'ws://localhost:5279',
ws: true
},
}
},
host: true
},
}
});

0 comments on commit 753b480

Please sign in to comment.