Skip to content

Commit 0ccc24b

Browse files
authored
Merge pull request #35 from vincent99/main
UI Tweaks
2 parents 32b6ba0 + 1e2ca84 commit 0ccc24b

27 files changed

+16359
-8391
lines changed

ui/.ackrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@
1010
--ignore-dir=tmp
1111
--ignore-dir=vendor
1212
--ignore-file=ext:svg
13-
--ignore-file=is:selection.json
14-
--ignore-file=is:yarn.lock
13+
--ignore-file=is:package-lock.json

ui/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
build: clean
2-
yarn
3-
yarn generate
2+
npm install
3+
npm run generate
44
rm -rf ../static/ui/_nuxt
55
cp -rp .output/public/* ../static/ui/
66
touch ../static/ui/_nuxt/_placeholder
77

88
clean:
9-
yarn clean
9+
npm run clean

ui/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introdu
55
## Setup
66

77
```bash
8-
yarn install
8+
npm install
99
```
1010

1111
## Development Server
1212

1313
Start the development server on `http://localhost:9091`:
1414

1515
```bash
16-
yarn dev
16+
npm run dev
1717
```
1818

1919
## Production
2020

21-
Build the application for embedding into GPTScript:
21+
Build the application for embedding into GPTScript (the Makefile does this):
2222

2323
```bash
24-
yarn run generate
24+
npm run generate
2525
```

ui/app.config.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ export default defineAppConfig({
44
gray: 'cool',
55

66
card: {
7+
header: {
8+
padding: 'px-1 py-1 sm:p-2',
9+
},
710
body: {
811
padding: 'px-1 py-1 sm:p-2'
9-
}
12+
},
13+
footer: {
14+
padding: 'px-1 py-1 sm:p-2'
15+
},
1016
}
1117
},
1218
})

ui/app.vue

+85-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,53 @@
11
<script lang="ts" setup>
2-
import '@/styles/app.scss'
2+
const sock = useSocket()
3+
const router = useRouter()
4+
5+
useHead({
6+
meta: [
7+
{ charset: 'utf-8' },
8+
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
9+
{ name: 'format-detection', content: 'telephone=no' },
10+
{ name: 'viewport', content: `width=device-width, height=device-height` },
11+
],
12+
})
13+
14+
const root = ref<HTMLDivElement>()
15+
16+
watch(router.currentRoute, () => {
17+
root.value?.classList.remove('open')
18+
})
19+
20+
21+
function toggle() {
22+
root.value?.classList.toggle('open')
23+
}
324
</script>
25+
426
<template>
5-
<div class="root bg-slate-100 dark:bg-slate-950">
6-
<LeftNav class="left-nav bg-slate-200 dark:bg-slate-900"/>
27+
<div ref="root" class="root bg-slate-50 dark:bg-slate-950">
28+
<header class="flex bg-slate-300 dark:bg-slate-900">
29+
<div class="toggle flex-initial p-2">
30+
<UButton icon="i-heroicons-bars-3" @click="toggle"/>
31+
</div>
32+
<div class="flex-initial">
33+
<img src="~/assets/logo.svg" class="dark:invert" style="height: 100%; padding: 0.25rem;"/>
34+
</div>
35+
36+
<div class="flex-1"/>
37+
38+
<div class="flex-initial text-right p-2" v-if="sock.sock.status !== 'OPEN'">
39+
<UBadge color="red" size="lg" variant="solid">
40+
<i class="i-heroicons-bolt-slash"/>&nbsp;{{ucFirst(sock.sock.status.toLowerCase())}}
41+
</UBadge>
42+
</div>
43+
44+
<div class="text-right p-2 flex-initial">
45+
<ThemeToggle />
46+
</div>
47+
</header>
48+
49+
<LeftNav class="left-nav bg-slate-100 dark:bg-slate-900"/>
50+
751
<main>
852
<NuxtPage />
953
</main>
@@ -12,17 +56,24 @@
1256

1357
<style lang="scss" scoped>
1458
.root {
15-
--nav-width: 300px;
59+
--nav-width: 500px;
60+
--header-height: 50px;
1661
1762
display: grid;
18-
grid-template-areas: "nav main";
19-
grid-template-columns: var(--nav-width) 1fr;
20-
2163
position: absolute;
2264
top: 0;
2365
left: 0;
2466
right: 0;
2567
bottom: 0;
68+
overflow: hidden;
69+
70+
grid-template-areas: "header header" "nav main";
71+
grid-template-rows: var(--header-height) 1fr;
72+
grid-template-columns: 300px 1fr;
73+
74+
HEADER {
75+
grid-area: header;
76+
}
2677
2778
.left-nav {
2879
grid-area: nav;
@@ -36,4 +87,31 @@
3687
padding: 1rem;
3788
}
3889
}
90+
91+
// Desktop
92+
@media all and (min-width: 768px) {
93+
.root {
94+
.toggle {
95+
display: none;
96+
}
97+
}
98+
}
99+
100+
// Mobile
101+
@media all and (max-width: 767px) {
102+
.root {
103+
grid-template-columns: 0 100%;
104+
transition: grid-template-columns 250ms;
105+
106+
.left-nav { opacity: 0; }
107+
MAIN { opacity: 1}
108+
}
109+
.root.open {
110+
grid-template-columns: 100% 0;
111+
112+
.left-nav { opacity: 1; }
113+
MAIN { opacity: 0; }
114+
}
115+
}
116+
39117
</style>

ui/assets/logo.svg

+148
Loading
File renamed without changes.

ui/assets/styles/app.scss

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import "./base";
2+
@import "./poppins/poppins";

0 commit comments

Comments
 (0)