Skip to content

Commit

Permalink
base ui impl
Browse files Browse the repository at this point in the history
  • Loading branch information
pwh-pwh committed Jul 23, 2024
1 parent 7c404e6 commit 9c43a4c
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 6 deletions.
6 changes: 6 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@primevue/themes": "^4.0.0",
"primeflex": "^3.3.1",
"primeicons": "^7.0.0",
"primevue": "^4.0.0",
"vue": "^3.2.37"
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bc5ad54de95730f20ae4b320b68769c8
3e1da23264839779d64d02fe5e6ccc8e
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Chat from "./components/Chat.vue";
</script>

<template>
<div class="border-round-3xl p-3 surface-card">
<div class="border-round-3xl p-3 h-full" style="background-color:rgba(255,255,255,0.53);">
<Chat />
</div>
</template>
Expand Down
30 changes: 27 additions & 3 deletions frontend/src/components/Chat.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
<script setup lang="ts">
import MsgItem from "./MsgItem.vue";
import {reactive, ref} from "vue";
import {Message} from "../types/Message";
const msgList = reactive<Message[]>([{content: 'hello', userType: 'user', id: '1'},
{content: 'how are you', userType: 'assistant', id: '2'}])
const inputMsg = ref('')
</script>

<template>
<div>
<div class="p-3 flex justify-content-center">
<div></div>
<div class="flex text-center flex-column h-full">
<div class="flex-shrink-0 text-center">
<div class="text-white-alpha-80 text-3xl font-bold">
Ai-Gui
</div>

</div>

<div class="flex-1 overflow-auto bg-blue-400 border-2 border-white-alpha-40 border-round p-2">
<ScrollPanel class="w-full h-full">
<MsgItem v-for="(item,idx) in msgList" :message="item" :key="idx"/>
</ScrollPanel>
</div>

<div class="flex-grow flex flex-column mt-2">
<div class="flex-shrink-0 text-center flex w-full">
<InputText type="text" class="flex-grow-1 bg-black-alpha-50" v-model="inputMsg"/>
<Button icon="pi pi-send" class="ml-2"/>
</div>

</div>
</div>
</template>
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/components/MsgItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup lang="ts">
import {computed} from "vue";
import {Message} from "../types/Message";
const props = defineProps<{ message: Message }>()
const positionClass = computed(() => {
if (props.message.userType === "assistant") {
return "flex-row"
} else {
return "flex-row-reverse"
}
})
</script>

<template>
<div :class="['flex align-items-start mb-4 px-3', positionClass]">
<div class="w-2 h-12 border-circle mr-4">
<i class="pi pi-user"></i>
</div>
<div class="bg-gray-200 border-round p-1 w-full">
<p class="text-gray-800 text-left pl-2">
{{ message.content }}
</p>
</div>
</div>
</template>

<style scoped>
</style>
2 changes: 2 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import PrimeVue from 'primevue/config'
import Aura from '@primevue/themes/aura'
import 'primeflex/primeflex.css';
import './style.css';
import 'primeicons/primeicons.css'


const app = createApp(App)
app.use(PrimeVue, {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ html {

body {
margin: 0;
color: #000000;
color: #ffffff;
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/types/Message.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface Message {
id: string
content: string
userType: string
}

0 comments on commit 9c43a4c

Please sign in to comment.