Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Add lint check for user ui #1485

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/user-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: admin

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- ui/user/**

jobs:
lint:
runs-on: depot-ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.17.0"

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3

- name: Run linter
run: |
cd ui/user
pnpm install
pnpm run build
pnpm run ci

- name: Verify no changes
run: make no-changes
2 changes: 1 addition & 1 deletion ui/user/src/lib/components/navbar/Logo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
data-sveltekit-reload
class="flex rounded-3xl p-2 hover:bg-gray-70 dark:hover:bg-gray-900"
>
<div class="flex flex-shrink-0 h-5 items-center">
<div class="flex h-5 flex-shrink-0 items-center">
<AssistantIcon id={assistant.id} />
</div>
<div class="ms-2 text-sm">
Expand Down
23 changes: 14 additions & 9 deletions ui/user/src/lib/icons/AssistantIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
let { id, class: klass }: Props = $props();

let assistant = $derived(
$currentAssistant?.id === id ? $currentAssistant :
$assistants.find((a) => {
if (id) {
return a.id === id;
}
return a.current;
})
$currentAssistant?.id === id
? $currentAssistant
: $assistants.find((a) => {
if (id) {
return a.id === id;
}
return a.current;
})
);

function getIcon(a: Assistant | undefined): string {
Expand All @@ -31,7 +32,7 @@
}
return a.icons.icon ?? '';
}

function hasDarkIcon(a: Assistant | undefined): boolean {
if (!a) {
return false;
Expand All @@ -41,7 +42,11 @@
</script>

{#if getIcon(assistant)}
<img src={getIcon(assistant)} alt="assistant icon" class={twMerge('h-5 w-5', !hasDarkIcon(assistant) && 'dark:invert', klass)} />
<img
src={getIcon(assistant)}
alt="assistant icon"
class={twMerge('h-5 w-5', !hasDarkIcon(assistant) && 'dark:invert', klass)}
/>
{:else}
<div
class={twMerge(
Expand Down