Skip to content

Commit

Permalink
Merge pull request #35 from vincent99/main
Browse files Browse the repository at this point in the history
UI Tweaks
  • Loading branch information
vincent99 authored Feb 13, 2024
2 parents 32b6ba0 + 1e2ca84 commit 0ccc24b
Show file tree
Hide file tree
Showing 27 changed files with 16,359 additions and 8,391 deletions.
3 changes: 1 addition & 2 deletions ui/.ackrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
--ignore-dir=tmp
--ignore-dir=vendor
--ignore-file=ext:svg
--ignore-file=is:selection.json
--ignore-file=is:yarn.lock
--ignore-file=is:package-lock.json
6 changes: 3 additions & 3 deletions ui/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
build: clean
yarn
yarn generate
npm install
npm run generate
rm -rf ../static/ui/_nuxt
cp -rp .output/public/* ../static/ui/
touch ../static/ui/_nuxt/_placeholder

clean:
yarn clean
npm run clean
8 changes: 4 additions & 4 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introdu
## Setup

```bash
yarn install
npm install
```

## Development Server

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

```bash
yarn dev
npm run dev
```

## Production

Build the application for embedding into GPTScript:
Build the application for embedding into GPTScript (the Makefile does this):

```bash
yarn run generate
npm run generate
```
8 changes: 7 additions & 1 deletion ui/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ export default defineAppConfig({
gray: 'cool',

card: {
header: {
padding: 'px-1 py-1 sm:p-2',
},
body: {
padding: 'px-1 py-1 sm:p-2'
}
},
footer: {
padding: 'px-1 py-1 sm:p-2'
},
}
},
})
92 changes: 85 additions & 7 deletions ui/app.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,53 @@
<script lang="ts" setup>
import '@/styles/app.scss'
const sock = useSocket()
const router = useRouter()
useHead({
meta: [
{ charset: 'utf-8' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'format-detection', content: 'telephone=no' },
{ name: 'viewport', content: `width=device-width, height=device-height` },
],
})
const root = ref<HTMLDivElement>()
watch(router.currentRoute, () => {
root.value?.classList.remove('open')
})
function toggle() {
root.value?.classList.toggle('open')
}
</script>

<template>
<div class="root bg-slate-100 dark:bg-slate-950">
<LeftNav class="left-nav bg-slate-200 dark:bg-slate-900"/>
<div ref="root" class="root bg-slate-50 dark:bg-slate-950">
<header class="flex bg-slate-300 dark:bg-slate-900">
<div class="toggle flex-initial p-2">
<UButton icon="i-heroicons-bars-3" @click="toggle"/>
</div>
<div class="flex-initial">
<img src="~/assets/logo.svg" class="dark:invert" style="height: 100%; padding: 0.25rem;"/>
</div>

<div class="flex-1"/>

<div class="flex-initial text-right p-2" v-if="sock.sock.status !== 'OPEN'">
<UBadge color="red" size="lg" variant="solid">
<i class="i-heroicons-bolt-slash"/>&nbsp;{{ucFirst(sock.sock.status.toLowerCase())}}
</UBadge>
</div>

<div class="text-right p-2 flex-initial">
<ThemeToggle />
</div>
</header>

<LeftNav class="left-nav bg-slate-100 dark:bg-slate-900"/>

<main>
<NuxtPage />
</main>
Expand All @@ -12,17 +56,24 @@

<style lang="scss" scoped>
.root {
--nav-width: 300px;
--nav-width: 500px;
--header-height: 50px;
display: grid;
grid-template-areas: "nav main";
grid-template-columns: var(--nav-width) 1fr;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
grid-template-areas: "header header" "nav main";
grid-template-rows: var(--header-height) 1fr;
grid-template-columns: 300px 1fr;
HEADER {
grid-area: header;
}
.left-nav {
grid-area: nav;
Expand All @@ -36,4 +87,31 @@
padding: 1rem;
}
}
// Desktop
@media all and (min-width: 768px) {
.root {
.toggle {
display: none;
}
}
}
// Mobile
@media all and (max-width: 767px) {
.root {
grid-template-columns: 0 100%;
transition: grid-template-columns 250ms;
.left-nav { opacity: 0; }
MAIN { opacity: 1}
}
.root.open {
grid-template-columns: 100% 0;
.left-nav { opacity: 1; }
MAIN { opacity: 0; }
}
}
</style>
148 changes: 148 additions & 0 deletions ui/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
2 changes: 2 additions & 0 deletions ui/assets/styles/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "./base";
@import "./poppins/poppins";
Loading

0 comments on commit 0ccc24b

Please sign in to comment.