Skip to content

Commit 77d7f3f

Browse files
committed
responsive fixes
1 parent 294b05e commit 77d7f3f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

AiServer/wwwroot/Ui.mjs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import SpeechToText from "/mjs/components/SpeechToText.mjs"
2727
import TextToSpeech from "/mjs/components/TextToSpeech.mjs"
2828
import Transform from "/mjs/components/Transform.mjs"
2929
import UiHome from "/mjs/components/UiHome.mjs"
30+
import { prefixes, icons } from "/mjs/utils.mjs"
3031

3132
const HomeSection = {
3233
id: '',
@@ -56,15 +57,17 @@ export default {
5657
<div class="flex h-16 justify-between">
5758
<div class="flex">
5859
<div class="flex flex-shrink-0 items-center">
59-
<a href="/">
60-
<img class="cursor-pointer block h-8 w-auto" src="/img/logo.svg" alt="Your Company">
60+
<a href="/" title="Home">
61+
<img class="cursor-pointer block h-8 w-auto" src="/img/logo.svg" alt="Home">
6162
</a>
6263
</div>
6364
<div class="hidden sm:-my-px sm:ml-2 lg:ml-4 sm:flex sm:space-x-4 xl:space-x-6">
6465
<a v-href="{admin:section.id}" v-for="section in sections"
6566
:class="['inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium', routes.admin==section.id ? 'border-indigo-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700']" aria-current="page">
67+
<span class="lg:hidden xl:inline mr-2" :title="section.label">
68+
<img :src="section.icon" class="w-6 h-6" :alt="section.label">
69+
</span>
6670
<span class="hidden lg:inline">{{section.label}}</span>
67-
<span class="lg:hidden">{{section.abbr}}</span>
6871
</a>
6972
</div>
7073
</div>
@@ -121,8 +124,7 @@ export default {
121124
:class="['block border-l-4 py-2 pl-3 pr-4 text-base font-medium', routes.admin==section.id
122125
? 'border-indigo-500 bg-indigo-50 text-indigo-700'
123126
: 'border-transparent text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800']" aria-current="page">
124-
<span class="hidden lg:inline">{{section.label}}</span>
125-
<span class="lg:hidden">{{section.abbr}}</span>
127+
<span class="">{{section.label}}</span>
126128
</a>
127129
<a href="/auth/logout?redirect=/" class="block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" tabindex="-1">Sign out</a>
128130
</div>
@@ -164,29 +166,18 @@ export default {
164166
function toLabel(id) {
165167
return humanify(id).replace('To','to')
166168
}
167-
function toAbbr(id) {
168-
return toLabel(id)
169-
.replaceAll('Image','img')
170-
.replaceAll('Text','txt')
171-
.replaceAll('Speech','spch')
172-
.replaceAll(' to ','2')
173-
.toLowerCase()
174-
}
175169
const sections = Object.keys(components).map(id => ({
176170
id,
177171
label: toLabel(id),
178172
component: components[id],
179-
abbr: toAbbr(id),
173+
icon: icons[prefixes[id]],
174+
prefix: prefixes[id],
180175
}))
181176

182177
const overrides = {
183178
ImageUpscale: {
184179
label: 'Upscale',
185-
abbr:'upscale'
186180
},
187-
Transform: {
188-
abbr: 'ffmpeg'
189-
}
190181
}
191182

192183
Object.keys(overrides).forEach(id => {

AiServer/wwwroot/mjs/utils.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ import { useFormatters, useClient } from "@servicestack/vue"
33
import { EventBus } from "@servicestack/client"
44
const { truncate } = useFormatters()
55

6+
export const prefixes = {
7+
Chat: 'chat',
8+
TextToImage: 'txt2img',
9+
ImageToText: 'img2txt',
10+
ImageToImage: 'img2img',
11+
ImageUpscale: 'upscale',
12+
SpeechToText: 'spch2txt',
13+
TextToSpeech: 'txt2spch',
14+
Transform: 'ffmpeg',
15+
}
16+
617
export function iconDataUri(svg) {
718
return styleDataUri(Image.svgToDataUri(svg).replaceAll('"', "'"))
819
}

0 commit comments

Comments
 (0)