Skip to content

Commit b87266a

Browse files
committed
Add ai assistant
1 parent c07921a commit b87266a

26 files changed

Lines changed: 1696 additions & 117 deletions

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
dist
3+
.git
4+
.angular
5+
.vscode
6+
*.log

.github/workflows/docker.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build-and-push:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to Container Registry
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=ref,event=branch
46+
type=ref,event=pr
47+
type=semver,pattern=v{{version}}
48+
type=semver,pattern=v{{major}}.{{minor}}
49+
type=semver,pattern=v{{major}}
50+
type=raw,value=latest,enable={{is_default_branch}}
51+
52+
- name: Build and push
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: .
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Build stage
2+
FROM oven/bun:1 AS builder
3+
4+
WORKDIR /app
5+
6+
# Install dependencies
7+
COPY package.json bun.lock ./
8+
RUN bun install --frozen-lockfile
9+
10+
# Copy source and build
11+
COPY . .
12+
RUN bun run build
13+
14+
# Production stage
15+
FROM nginx:1.25-alpine
16+
17+
# Copy built assets
18+
COPY --from=builder /app/dist/browser /usr/share/nginx/html
19+
20+
# Copy wasm manually (Angular asset config doesn't work reliably)
21+
COPY --from=builder /app/node_modules/@openworkers/croner-wasm/dist/*.wasm /usr/share/nginx/html/assets/wasm/
22+
23+
# Add wasm MIME type
24+
RUN echo 'types { application/wasm wasm; }' >> /etc/nginx/mime.types
25+
26+
# SPA routing config
27+
RUN cat <<'EOF' > /etc/nginx/conf.d/default.conf
28+
server {
29+
listen 80;
30+
root /usr/share/nginx/html;
31+
index index.html;
32+
33+
gzip on;
34+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript application/wasm;
35+
36+
location / {
37+
try_files $uri $uri/ /index.html;
38+
}
39+
40+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|wasm)$ {
41+
expires 1y;
42+
add_header Cache-Control "public, immutable";
43+
}
44+
}
45+
EOF
46+
47+
EXPOSE 80
48+
49+
CMD ["nginx", "-g", "daemon off;"]

angular.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"assets": [
5151
"src/assets",
5252
{
53-
"glob": "**/*.wasm",
54-
"input": "./node_modules/@openworkers/croner-wasm/dist",
53+
"glob": "*.wasm",
54+
"input": "node_modules/@openworkers/croner-wasm/dist",
5555
"output": "assets/wasm"
5656
},
5757
{
@@ -84,8 +84,8 @@
8484
},
8585
{
8686
"type": "anyComponentStyle",
87-
"maximumWarning": "2kb",
88-
"maximumError": "4kb"
87+
"maximumWarning": "4kb",
88+
"maximumError": "8kb"
8989
}
9090
],
9191
"fileReplacements": [

bun.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"@angular/platform-browser-dynamic": "^21.0.0",
2222
"@angular/router": "^21.0.0",
2323
"@materia-ui/ngx-monaco-editor": "^6.0.0",
24+
"@ng-icons/core": "^33.0.0",
25+
"@ng-icons/heroicons": "^33.0.0",
2426
"@openworkers/croner-wasm": "^0.3.0",
27+
"dexie": "^4.2.1",
2528
"monaco-editor": "0.55.1",
2629
"rxjs": "^7.8.1",
2730
"tslib": "^2.3.0"

src/app/app.component.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@
3939
@if (user.avatarUrl) {
4040
<img class="rounded-full w-8 min-h-8" [src]="user.avatarUrl" [alt]="user.username" />
4141
} @else {
42-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
43-
<path
44-
d="M11.1 35.25q3.15-2.2 6.25-3.375Q20.45 30.7 24 30.7q3.55 0 6.675 1.175t6.275 3.375q2.2-2.7 3.125-5.45Q41 27.05 41 24q0-7.25-4.875-12.125T24 7q-7.25 0-12.125 4.875T7 24q0 3.05.95 5.8t3.15 5.45ZM24 25.5q-2.9 0-4.875-1.975T17.15 18.65q0-2.9 1.975-4.875T24 11.8q2.9 0 4.875 1.975t1.975 4.875q0 2.9-1.975 4.875T24 25.5ZM24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 24q0-4.15 1.575-7.775t4.3-6.35q2.725-2.725 6.375-4.3Q19.9 4 24 4q4.15 0 7.775 1.575t6.35 4.3q2.725 2.725 4.3 6.35Q44 19.85 44 24q0 4.1-1.575 7.75-1.575 3.65-4.3 6.375-2.725 2.725-6.35 4.3Q28.15 44 24 44Zm0-3q2.75 0 5.375-.8t5.175-2.8q-2.55-1.8-5.2-2.75-2.65-.95-5.35-.95-2.7 0-5.35.95-2.65.95-5.2 2.75 2.55 2 5.175 2.8Q21.25 41 24 41Zm0-18.5q1.7 0 2.775-1.075t1.075-2.775q0-1.7-1.075-2.775T24 14.8q-1.7 0-2.775 1.075T20.15 18.65q0 1.7 1.075 2.775T24 22.5Zm0-3.85Zm0 18.7Z"
45-
/>
46-
</svg>
42+
<ng-icon name="heroUser" class="w-8 h-8" />
4743
}
4844
</a>
4945
</div>

src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import { RouterDataService } from './services/router-data.service';
99
import { logger } from '~/logger';
1010
import { CommonModule } from '@angular/common';
1111
import { RouterModule } from '@angular/router';
12+
import { NgIconComponent } from '@ng-icons/core';
1213
import { ThemeSwitchComponent } from './shared/theme-switch/theme-switch.component';
1314

1415
const log = logger.getLogger('AppComponent');
1516

1617
@Component({
17-
imports: [CommonModule, RouterModule, ThemeSwitchComponent],
18+
imports: [CommonModule, RouterModule, NgIconComponent, ThemeSwitchComponent],
1819
selector: 'app-root',
1920
templateUrl: 'app.component.html'
2021
})

src/app/app.config.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ import { provideRouter } from '@angular/router';
1111
import { provideHttpClient, withFetch, withInterceptorsFromDi } from '@angular/common/http';
1212
import { routes } from './app.routes';
1313
import { ThemeService } from './services/theme.service';
14+
import { provideIcons } from '@ng-icons/core';
15+
import {
16+
heroClock,
17+
heroArrowTopRightOnSquare,
18+
heroArrowUturnLeft,
19+
heroCheckCircle,
20+
heroXCircle,
21+
heroPencilSquare,
22+
heroLockOpen,
23+
heroLockClosed,
24+
heroTrash,
25+
heroArrowPath,
26+
heroEllipsisVertical,
27+
heroPower,
28+
heroCog6Tooth,
29+
heroChevronRight,
30+
heroMicrophone,
31+
heroUser
32+
} from '@ng-icons/heroicons/outline';
1433

1534
export const appConfig: ApplicationConfig = {
1635
providers: [
@@ -24,6 +43,24 @@ export const appConfig: ApplicationConfig = {
2443
},
2544
provideZonelessChangeDetection(),
2645
provideRouter(routes),
27-
provideHttpClient(withFetch(), withInterceptorsFromDi())
46+
provideHttpClient(withFetch(), withInterceptorsFromDi()),
47+
provideIcons({
48+
heroClock,
49+
heroArrowTopRightOnSquare,
50+
heroArrowUturnLeft,
51+
heroCheckCircle,
52+
heroXCircle,
53+
heroPencilSquare,
54+
heroLockOpen,
55+
heroLockClosed,
56+
heroTrash,
57+
heroArrowPath,
58+
heroEllipsisVertical,
59+
heroPower,
60+
heroCog6Tooth,
61+
heroChevronRight,
62+
heroMicrophone,
63+
heroUser
64+
})
2865
]
2966
};

src/app/modules/resource-list/resource-list.page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h3 class="title capitalize">{{ resourceName }}s</h3>
3434
<a class="font-bold" [routerLink]="['/', resourceName, resource.id]"> {{ resource.name }} </a>
3535
<p class="font-light" [ngClass]="{ 'italic': !resource.desc }">{{ resource.desc ?? 'No description' }}</p>
3636
<div class="flex items-center mt-3 text-gray-500">
37-
<i icon="clock"></i>
37+
<ng-icon name="heroClock" />
3838
<span class="ml-3">Last modified {{ resource.updatedAt | date: 'MMM d, y - HH:mm:ss' }}</span>
3939
</div>
4040
</div>
@@ -44,7 +44,7 @@ <h3 class="title capitalize">{{ resourceName }}s</h3>
4444
class="btn-outline hover:shadow-sm justify-between gap-2"
4545
[routerLink]="['/', resourceName, resource.id]"
4646
>
47-
<i icon="pencil-square" class="mr-1"></i>
47+
<ng-icon name="heroPencilSquare" class="mr-1" />
4848
Edit
4949
</a>
5050
</ng-container>
@@ -54,7 +54,7 @@ <h3 class="title capitalize">{{ resourceName }}s</h3>
5454
[href]="getWorkerUrl(resource.name)"
5555
target="_blank"
5656
>
57-
<i icon="new-tab" class="mr-1"></i>
57+
<ng-icon name="heroArrowTopRightOnSquare" class="mr-1" />
5858
View
5959
</a>
6060
}

0 commit comments

Comments
 (0)