Compare commits
2 Commits
2cc21bb284
...
944e53df63
| Author | SHA1 | Date | |
|---|---|---|---|
| 944e53df63 | |||
| 54fa90b2a5 |
813
package-lock.json
generated
813
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -15,10 +15,15 @@
|
|||||||
"format": "prettier --write --experimental-cli src/"
|
"format": "prettier --write --experimental-cli src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/roboto": "^5.2.9",
|
"@primeuix/themes": "^2.0.3",
|
||||||
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
|
"@vueuse/core": "^14.2.1",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^3.0.4",
|
||||||
"vue": "^3.5.28",
|
"primeicons": "^7.0.0",
|
||||||
"vuetify": "^3.11.8"
|
"primevue": "^4.5.4",
|
||||||
|
"tailwindcss": "^4.2.1",
|
||||||
|
"tailwindcss-primeui": "^0.6.1",
|
||||||
|
"vue": "^3.5.28"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mdi/font": "^7.4.47",
|
"@mdi/font": "^7.4.47",
|
||||||
|
|||||||
23
src/App.vue
23
src/App.vue
@@ -1,25 +1,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ChatView from '@/views/ChatView.vue'
|
|
||||||
import { useAuthStore } from '@/stores/auth.ts'
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
import SignInView from '@/views/SignInView.vue'
|
import SignInView from '@/views/SignInView.vue'
|
||||||
|
import MainView from '@/views/MainView.vue'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-app>
|
<div class="h-screen bg-gray-200">
|
||||||
<v-main class="chat-fullscreen">
|
<div class="h-full m-auto p-4">
|
||||||
<v-container fluid class="h-100 pa-0">
|
<MainView v-if="authStore.isAuth" />
|
||||||
<chat-view v-if="authStore.isAuth" />
|
<SignInView v-else />
|
||||||
<sign-in-view v-else />
|
</div>
|
||||||
<!-- <sign-in-view />-->
|
</div>
|
||||||
</v-container>
|
|
||||||
</v-main>
|
|
||||||
</v-app>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style></style>
|
||||||
.chat-fullscreen {
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
53
src/assets/custom.css
Normal file
53
src/assets/custom.css
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
html {
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
font-family: "Inter", sans-serif;
|
||||||
|
font-optical-sizing: auto;
|
||||||
|
font-variation-settings: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Light */
|
||||||
|
:root {
|
||||||
|
--p-primary-color: var(--p-primary-500);
|
||||||
|
--p-primary-contrast-color: var(--p-surface-0);
|
||||||
|
--p-primary-hover-color: var(--p-primary-600);
|
||||||
|
--p-primary-active-color: var(--p-primary-700);
|
||||||
|
--p-content-border-color: var(--p-surface-200);
|
||||||
|
--p-content-hover-background: var(--p-surface-100);
|
||||||
|
--p-content-hover-color: var(--p-surface-800);
|
||||||
|
--p-highlight-background: var(--p-primary-50);
|
||||||
|
--p-highlight-color: var(--p-primary-700);
|
||||||
|
--p-highlight-focus-background: var(--p-primary-100);
|
||||||
|
--p-highlight-focus-color: var(--p-primary-800);
|
||||||
|
--p-text-color: var(--p-surface-700);
|
||||||
|
--p-text-hover-color: var(--p-surface-800);
|
||||||
|
--p-text-muted-color: var(--p-surface-500);
|
||||||
|
--p-text-hover-muted-color: var(--p-surface-600);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark */
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--p-primary-color: var(--p-primary-400);
|
||||||
|
--p-primary-contrast-color: var(--p-surface-900);
|
||||||
|
--p-primary-hover-color: var(--p-primary-300);
|
||||||
|
--p-primary-active-color: var(--p-primary-200);
|
||||||
|
--p-content-border-color: var(--p-surface-700);
|
||||||
|
--p-content-hover-background: var(--p-surface-800);
|
||||||
|
--p-content-hover-color: var(--p-surface-0);
|
||||||
|
--p-highlight-background: color-mix(in srgb, var(--p-primary-400), transparent 84%);
|
||||||
|
--p-highlight-color: rgba(255, 255, 255, 0.87);
|
||||||
|
--p-highlight-focus-background: color-mix(in srgb, var(--p-primary-400), transparent 76%);
|
||||||
|
--p-highlight-focus-color: rgba(255, 255, 255, 0.87);
|
||||||
|
--p-text-color: var(--p-surface-0);
|
||||||
|
--p-text-hover-color: var(--p-surface-0);
|
||||||
|
--p-text-muted-color: var(--p-surface-400);
|
||||||
|
--p-text-hover-muted-color: var(--p-surface-300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-dark {
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
26
src/assets/default.css
Normal file
26
src/assets/default.css
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
:root {
|
||||||
|
--p-primary-50: #ecfdf5;
|
||||||
|
--p-primary-100: #d1fae5;
|
||||||
|
--p-primary-200: #a7f3d0;
|
||||||
|
--p-primary-300: #6ee7b7;
|
||||||
|
--p-primary-400: #34d399;
|
||||||
|
--p-primary-500: #10b981;
|
||||||
|
--p-primary-600: #059669;
|
||||||
|
--p-primary-700: #047857;
|
||||||
|
--p-primary-800: #065f46;
|
||||||
|
--p-primary-900: #064e3b;
|
||||||
|
--p-primary-950: #022c22;
|
||||||
|
--p-surface-0: #ffffff;
|
||||||
|
--p-surface-50: #fafafa;
|
||||||
|
--p-surface-100: #f4f4f5;
|
||||||
|
--p-surface-200: #e4e4e7;
|
||||||
|
--p-surface-300: #d4d4d8;
|
||||||
|
--p-surface-400: #a1a1aa;
|
||||||
|
--p-surface-500: #71717a;
|
||||||
|
--p-surface-600: #52525b;
|
||||||
|
--p-surface-700: #3f3f46;
|
||||||
|
--p-surface-800: #27272a;
|
||||||
|
--p-surface-900: #18181b;
|
||||||
|
--p-surface-950: #09090b;
|
||||||
|
--p-content-border-radius: 6px;
|
||||||
|
}
|
||||||
3
src/assets/main.css
Normal file
3
src/assets/main.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
@import "tailwindcss-primeui";
|
||||||
|
@import "primeicons/primeicons.css";
|
||||||
137
src/assets/main1.css
Normal file
137
src/assets/main1.css
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
.chat-fullscreen {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-100 {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-20r {
|
||||||
|
height: 20rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-40r {
|
||||||
|
height: 40rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-5r {
|
||||||
|
width: 5rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-20r {
|
||||||
|
width: 20rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-40r {
|
||||||
|
width: 40rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-50r {
|
||||||
|
width: 50rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-60r {
|
||||||
|
width: 60rem
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-auto {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
.d-flex {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.flex-column {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.flex-row-reverse {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-column-reverse {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-grow-0 {
|
||||||
|
flex-grow: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-grow-1 {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-center {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.justify-center {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-y-auto{
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overflow-hidden {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.ga-2 {
|
||||||
|
gap: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ga-4 {
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pa-1 {
|
||||||
|
padding: .25rem;
|
||||||
|
}
|
||||||
|
.pa-2 {
|
||||||
|
padding: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pa-4 {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.py-4 {
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.px-4 {
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.px-8 {
|
||||||
|
padding: 0 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background: #e68181;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue {
|
||||||
|
background: #5d5ded;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
background: #82e882;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yellow {
|
||||||
|
background: #eaea83;
|
||||||
|
}
|
||||||
22
src/components/AppMenu.vue
Normal file
22
src/components/AppMenu.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { JustList, JustListItem, JustNav } from '@/components/simple'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const model = defineModel<string>()
|
||||||
|
|
||||||
|
function onSelect(value: string) {
|
||||||
|
model.value = value
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<JustNav>
|
||||||
|
<JustList>
|
||||||
|
<JustListItem value="users" icon="mdi-account" @click="onSelect" />
|
||||||
|
<JustListItem value="messages" icon="mdi-message" @click="onSelect" />
|
||||||
|
<JustListItem value="settings" icon="mdi-cog" @click="onSelect" />
|
||||||
|
</JustList>
|
||||||
|
</JustNav>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
35
src/components/ChatListElement.vue
Normal file
35
src/components/ChatListElement.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Chat } from '@/stores/chats.ts'
|
||||||
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
chat: Chat
|
||||||
|
}
|
||||||
|
|
||||||
|
const { chat } = defineProps<Props>()
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
|
const getChatName = computed(() => {
|
||||||
|
if (chat.type_id === 2) {
|
||||||
|
return chat.name
|
||||||
|
} else if (chat.type_id === 1) {
|
||||||
|
const otherUsers = chat.users.filter((user) => user.id !== authStore.me?.id)
|
||||||
|
return otherUsers[0]?.name ?? otherUsers[0]?.email ?? 'unknown'
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'unknown ID'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="border p-2">
|
||||||
|
<!-- {{ chat }}-->
|
||||||
|
<div>id:{{ chat.id }}</div>
|
||||||
|
<div>name:{{ chat.name }}</div>
|
||||||
|
<div>type:{{ chat.type_id }}</div>
|
||||||
|
<div>chatName:{{ getChatName }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue'
|
|
||||||
|
|
||||||
const search = ref('')
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="d-flex align-center ga-4">
|
|
||||||
<v-btn icon="mdi-menu" variant="text"></v-btn>
|
|
||||||
<v-text-field
|
|
||||||
v-model="search"
|
|
||||||
rounded="xl"
|
|
||||||
density="compact"
|
|
||||||
hide-details
|
|
||||||
variant="outlined"
|
|
||||||
bg-color="black"
|
|
||||||
base-color="black"
|
|
||||||
color="primary"
|
|
||||||
placeholder="Search..."
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
14
src/components/Chats/ChatToolbar.vue
Normal file
14
src/components/Chats/ChatToolbar.vue
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const search = ref('')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex gap-2 p-4 border bg-amber-200">
|
||||||
|
<button>menu</button>
|
||||||
|
<input v-model="search" placeholder="Search..." />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
38
src/components/Chats/ChatsList.vue
Normal file
38
src/components/Chats/ChatsList.vue
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useChatsStore } from '@/stores/chats.ts'
|
||||||
|
import { SocketDataReq, useSocketsStore } from '@/stores/sockets.ts'
|
||||||
|
import ChatListElement from '@/components/ChatListElement.vue'
|
||||||
|
|
||||||
|
const chatsStore = useChatsStore()
|
||||||
|
const socketsStore = useSocketsStore()
|
||||||
|
|
||||||
|
function onSelect(id: string) {
|
||||||
|
const chatId = id
|
||||||
|
chatsStore.selected = chatId
|
||||||
|
|
||||||
|
socketsStore.send({
|
||||||
|
type: SocketDataReq.GET_MESSAGES,
|
||||||
|
data: { chat_id: chatId },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-2 h-full overflow-hidden px-2">
|
||||||
|
<div>chats</div>
|
||||||
|
|
||||||
|
<!-- <div class="overflow-y-auto">-->
|
||||||
|
<!-- <div v-for="i in 30" :key="i" class="pa-4 border">bla</div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<div class="flex flex-col gap-2 h-full overflow-y-auto">
|
||||||
|
<chat-list-element
|
||||||
|
v-for="chat in chatsStore.chats"
|
||||||
|
:key="chat.id"
|
||||||
|
v-bind="{ chat }"
|
||||||
|
@click="onSelect(chat.id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import ChatToolbar from '@/components/ChatToolbar.vue'
|
|
||||||
import ChatList from '@/components/ChatList.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<v-sheet class="pa-4 d-flex flex-column h-100" theme="dark">
|
|
||||||
<chat-toolbar />
|
|
||||||
<chat-list />
|
|
||||||
</v-sheet>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
@@ -1,15 +1,22 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ChatToolbar from '@/components/ChatToolbar.vue'
|
||||||
|
import ChatList from '@/components/ChatList.vue'
|
||||||
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
import { type Chat, useChatsStore } from '@/stores/chats.ts'
|
import { type Chat, useChatsStore } from '@/stores/chats.ts'
|
||||||
import { SocketDataReq, useSocketsStore } from '@/stores/sockets.ts'
|
import { SocketDataReq, useSocketsStore } from '@/stores/sockets.ts'
|
||||||
import { useAuthStore } from '@/stores/auth.ts'
|
import UserList from '@/components/Users/UserList.vue'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const chatsStore = useChatsStore()
|
const chatsStore = useChatsStore()
|
||||||
const socketsStore = useSocketsStore()
|
const socketsStore = useSocketsStore()
|
||||||
|
|
||||||
function onSelect(value: { id: unknown }) {
|
interface Props {
|
||||||
console.log('onSelectChat', value.id)
|
selected: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps()
|
||||||
|
|
||||||
|
function onSelect(value: { id: unknown }) {
|
||||||
const chatId = value.id as string
|
const chatId = value.id as string
|
||||||
chatsStore.selected = chatId
|
chatsStore.selected = chatId
|
||||||
|
|
||||||
@@ -32,26 +39,9 @@ function getChatName(chat: Chat) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-list theme="dark" density="compact" lines="two" @click:select="onSelect">
|
<div class="w-full flex flex-col h-full gap-2">
|
||||||
<v-list-subheader>Чаты</v-list-subheader>
|
<slot />
|
||||||
<v-list-item
|
|
||||||
v-for="chat in chatsStore.chats"
|
|
||||||
:key="chat.id"
|
|
||||||
:value="chat.id"
|
|
||||||
subtitle="last message..."
|
|
||||||
>
|
|
||||||
<template v-slot:title>{{ getChatName(chat) }} </template>
|
|
||||||
<template v-slot:prepend>
|
|
||||||
<v-avatar color="grey-lighten-1" text="V"> </v-avatar>
|
|
||||||
</template>
|
|
||||||
<template v-slot:append>
|
|
||||||
<div class="d-flex flex-column align-end">
|
|
||||||
<v-chip density="compact" size="small">0</v-chip>
|
|
||||||
<div class="text-caption">00:00</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
</v-list-item>
|
|
||||||
</v-list>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
@@ -35,29 +35,17 @@ const avatarLetter = computed(() => {
|
|||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
|
|
||||||
<v-sheet color="transparent" class="d-flex ga-2" :class="{ 'flex-row-reverse': props.my }">
|
<div class="flex gap-2 border" :class="{ 'flex-row-reverse': props.my }">
|
||||||
<!-- <v-avatar size="36" color="deep-purple-lighten-4">-->
|
<!-- <v-avatar size="36" color="deep-purple-lighten-4">-->
|
||||||
<!-- <span class="text-deep-purple-darken-2">{{ avatarLetter }}</span>-->
|
<!-- <span class="text-deep-purple-darken-2">{{ avatarLetter }}</span>-->
|
||||||
<!-- </v-avatar>-->
|
<!-- </v-avatar>-->
|
||||||
|
|
||||||
<!-- :class="props.my ? 'message-shaped-right' : 'message-shaped'"-->
|
<!-- :class="props.my ? 'message-shaped-right' : 'message-shaped'"-->
|
||||||
<v-sheet class="pa-4 message-width rounded-lg" :color="props.my ? 'primary' : 'white'">
|
<div class="pa-4" :class="props.my ? 'bg-blue-400' : 'bg-white'">
|
||||||
<span class="text-body-1">{{ props.text }}</span>
|
<span class="">{{ props.text }}</span>
|
||||||
<span class="text-caption ml-2">{{ createdAt }}</span>
|
<span class="">{{ createdAt }}</span>
|
||||||
</v-sheet>
|
</div>
|
||||||
</v-sheet>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
.message-shaped {
|
|
||||||
border-radius: 0 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-shaped-right {
|
|
||||||
border-radius: 24px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-width {
|
|
||||||
max-width: 66%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -27,37 +27,14 @@ const isEmptyText = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-row dense align="center">
|
<div class="d-flex ga-2 border pa-4">
|
||||||
<v-col>
|
<input v-model="text" placeholder="message" @keyup.enter="sendMessage" />
|
||||||
<v-text-field
|
<button><span class="mdi mdi-emoticon-outline"></span></button>
|
||||||
rounded="lg"
|
<button><span class="mdi mdi-paperclip"></span></button>
|
||||||
bg-color="white"
|
<button :disabled="isEmptyText" @click="sendMessage">
|
||||||
variant="outlined"
|
<span class="mdi mdi-send"></span>
|
||||||
hide-details
|
</button>
|
||||||
label="Message"
|
</div>
|
||||||
v-model="text"
|
|
||||||
@keyup.enter="sendMessage"
|
|
||||||
>
|
|
||||||
<template v-slot:prepend-inner>
|
|
||||||
<v-btn icon variant="text" density="compact" color="grey-darken-1">
|
|
||||||
<v-icon>mdi-emoticon-outline</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-text-field>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col v-if="false" cols="auto">
|
|
||||||
<v-btn icon variant="text" color="grey-darken-1">
|
|
||||||
<v-icon>mdi-paperclip</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="auto">
|
|
||||||
<v-btn :disabled="isEmptyText" icon variant="flat" color="primary" @click="sendMessage">
|
|
||||||
<v-icon>mdi-send</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts"></script>
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-toolbar color="white" class="flex-grow-0 px-4">
|
<div class="d-flex ga-2 pa-4 border">
|
||||||
<v-avatar color="grey-lighten-1" text="V"></v-avatar>
|
<div>V</div>
|
||||||
<v-toolbar-title class="">name</v-toolbar-title>
|
<div>name</div>
|
||||||
</v-toolbar>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import MessageToolbar from '@/components/MessageToolbar.vue'
|
|
||||||
import MessageForm from '@/components/MessageForm.vue'
|
|
||||||
import MessageData from '@/components/MessageData.vue'
|
|
||||||
import { useMessagesStore } from '@/stores/messages.ts'
|
|
||||||
import { useAuthStore } from '@/stores/auth.ts'
|
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
|
||||||
const messagesStore = useMessagesStore()
|
|
||||||
|
|
||||||
const messages = computed(() => {
|
|
||||||
return [...messagesStore.messages]
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="h-100 d-flex flex-column">
|
|
||||||
<message-toolbar />
|
|
||||||
|
|
||||||
<v-card
|
|
||||||
rounded="0"
|
|
||||||
variant="flat"
|
|
||||||
color="grey-lighten-3"
|
|
||||||
class="flex-grow-1 d-flex flex-column overflow-hidden"
|
|
||||||
>
|
|
||||||
<v-card-text class="flex-grow-1 d-flex ga-1 flex-column overflow-y-auto justify-end">
|
|
||||||
<message-data
|
|
||||||
v-for="message in messages"
|
|
||||||
:key="message.id"
|
|
||||||
:text="message.text"
|
|
||||||
:my="authStore.me?.id === message.user_id"
|
|
||||||
:created-at="message.created_at"
|
|
||||||
/>
|
|
||||||
</v-card-text>
|
|
||||||
|
|
||||||
<v-card-actions class="flex-grow-0 bg-white pa-4">
|
|
||||||
<message-form />
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
64
src/components/RightPane.vue
Normal file
64
src/components/RightPane.vue
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import MessageToolbar from '@/components/MessageToolbar.vue'
|
||||||
|
import MessageForm from '@/components/MessageForm.vue'
|
||||||
|
import MessageData from '@/components/MessageData.vue'
|
||||||
|
import { useMessagesStore } from '@/stores/messages.ts'
|
||||||
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
|
import { computed, nextTick, useTemplateRef, watch } from 'vue'
|
||||||
|
import { useScroll } from '@vueuse/core'
|
||||||
|
import { useChatsStore } from '@/stores/chats.ts'
|
||||||
|
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const messagesStore = useMessagesStore()
|
||||||
|
const chatsStore = useChatsStore()
|
||||||
|
|
||||||
|
const area = useTemplateRef('messageArea')
|
||||||
|
const { y, arrivedState } = useScroll(area)
|
||||||
|
|
||||||
|
const messages = computed(() => {
|
||||||
|
return [...messagesStore.messages]
|
||||||
|
})
|
||||||
|
|
||||||
|
async function scrollToBottom() {
|
||||||
|
await nextTick()
|
||||||
|
if (area.value) y.value = area.value?.scrollHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(messages, async () => {
|
||||||
|
await scrollToBottom()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="w-full h-full bg-blue-200 border">
|
||||||
|
<!-- <button class="position-absolute scroll-down" @click="scrollToBottom">UP</button>-->
|
||||||
|
<div class="flex flex-col h-full">
|
||||||
|
<div class="flex h-full flex-col overflow-hidden">
|
||||||
|
<message-toolbar class="grow-0" />
|
||||||
|
|
||||||
|
<div class="px-8 gap-2 grow flex flex-col-reverse overflow-y-auto" ref="messageArea">
|
||||||
|
<message-data
|
||||||
|
v-for="message in messages"
|
||||||
|
:key="message.id"
|
||||||
|
:text="message.text"
|
||||||
|
:my="authStore.me?.id === message.user_id"
|
||||||
|
:created-at="message.created_at"
|
||||||
|
></message-data>
|
||||||
|
<!-- <div class="p-4 border" v-for="v in 101" :key="v">text {{ v }}</div>-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<message-form class="grow-0 bg-green-200" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scroll-down {
|
||||||
|
right: 16px;
|
||||||
|
bottom: 104px;
|
||||||
|
}
|
||||||
|
.test {
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
5
src/components/Settings/SettingsList.vue
Normal file
5
src/components/Settings/SettingsList.vue
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<template>2</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
270
src/components/TestMenu1.vue
Normal file
270
src/components/TestMenu1.vue
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
<template>
|
||||||
|
<v-container class="d-flex" style="height: 600px; gap: 16px">
|
||||||
|
<!-- Постоянный rail drawer на v-card -->
|
||||||
|
<v-card width="72" height="100%" elevation="3" class="rail-drawer" rounded="lg">
|
||||||
|
<!-- Логотип/бренд -->
|
||||||
|
<div class="d-flex justify-center py-4">
|
||||||
|
<v-avatar color="primary" size="40" class="brand-avatar">
|
||||||
|
<span class="text-white font-weight-bold">V</span>
|
||||||
|
</v-avatar>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-divider></v-divider>
|
||||||
|
|
||||||
|
<!-- Основная навигация -->
|
||||||
|
<v-list density="compact" nav class="px-2 py-2">
|
||||||
|
<v-list-item
|
||||||
|
v-for="item in mainMenu"
|
||||||
|
:key="item.title"
|
||||||
|
:value="item.title"
|
||||||
|
:active="activeItem === item.title"
|
||||||
|
@click="activeItem = item.title"
|
||||||
|
class="rail-list-item mb-1"
|
||||||
|
:class="{ 'active-item': activeItem === item.title }"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<v-badge
|
||||||
|
v-if="item.badge"
|
||||||
|
:content="item.badge"
|
||||||
|
color="error"
|
||||||
|
dot
|
||||||
|
location="bottom end"
|
||||||
|
offset-x="2"
|
||||||
|
offset-y="2"
|
||||||
|
>
|
||||||
|
<v-icon :icon="item.icon" size="24"></v-icon>
|
||||||
|
</v-badge>
|
||||||
|
<v-icon v-else :icon="item.icon" size="24"></v-icon>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Тултип с названием -->
|
||||||
|
<v-tooltip
|
||||||
|
activator="parent"
|
||||||
|
location="right"
|
||||||
|
transition="slide-x-transition"
|
||||||
|
:open-delay="300"
|
||||||
|
>
|
||||||
|
{{ item.title }}
|
||||||
|
</v-tooltip>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
|
||||||
|
<v-divider></v-divider>
|
||||||
|
|
||||||
|
<!-- Нижняя группа иконок -->
|
||||||
|
<v-list density="compact" nav class="px-2 py-2" style="margin-top: auto">
|
||||||
|
<v-list-item
|
||||||
|
v-for="item in bottomMenu"
|
||||||
|
:key="item.title"
|
||||||
|
:value="item.title"
|
||||||
|
:active="activeItem === item.title"
|
||||||
|
@click="activeItem = item.title"
|
||||||
|
class="rail-list-item mb-1"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<v-icon :icon="item.icon" size="24"></v-icon>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-tooltip
|
||||||
|
activator="parent"
|
||||||
|
location="right"
|
||||||
|
transition="slide-x-transition"
|
||||||
|
:open-delay="300"
|
||||||
|
>
|
||||||
|
{{ item.title }}
|
||||||
|
</v-tooltip>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
|
||||||
|
<!-- Профиль пользователя внизу -->
|
||||||
|
<div class="mt-auto">
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<div class="d-flex justify-center py-3">
|
||||||
|
<v-menu location="top right" offset="15">
|
||||||
|
<template v-slot:activator="{ props }">
|
||||||
|
<v-avatar
|
||||||
|
size="44"
|
||||||
|
color="grey-lighten-2"
|
||||||
|
v-bind="props"
|
||||||
|
class="profile-avatar cursor-pointer"
|
||||||
|
>
|
||||||
|
<v-img src="https://randomuser.me/api/portraits/women/44.jpg"></v-img>
|
||||||
|
<v-tooltip activator="parent" location="right" :open-delay="300">
|
||||||
|
Профиль
|
||||||
|
</v-tooltip>
|
||||||
|
</v-avatar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Меню профиля -->
|
||||||
|
<v-card min-width="200" rounded="lg">
|
||||||
|
<v-list>
|
||||||
|
<v-list-item
|
||||||
|
prepend-avatar="https://randomuser.me/api/portraits/women/44.jpg"
|
||||||
|
title="Анна Петрова"
|
||||||
|
subtitle="anna@email.com"
|
||||||
|
></v-list-item>
|
||||||
|
</v-list>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<v-list>
|
||||||
|
<v-list-item
|
||||||
|
prepend-icon="mdi-account"
|
||||||
|
title="Мой профиль"
|
||||||
|
value="profile"
|
||||||
|
></v-list-item>
|
||||||
|
<v-list-item
|
||||||
|
prepend-icon="mdi-cog"
|
||||||
|
title="Настройки"
|
||||||
|
value="settings"
|
||||||
|
></v-list-item>
|
||||||
|
<v-list-item prepend-icon="mdi-logout" title="Выйти" value="logout"></v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-card>
|
||||||
|
</v-menu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
<!-- Основной контент -->
|
||||||
|
<v-card class="flex-grow-1 content-area" elevation="2" rounded="lg">
|
||||||
|
<!-- Хедер контента -->
|
||||||
|
<div class="d-flex align-center pa-4">
|
||||||
|
<div class="text-h5 font-weight-medium">
|
||||||
|
{{ getActiveTitle }}
|
||||||
|
</div>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn icon="mdi-bell-outline" variant="text" size="small"></v-btn>
|
||||||
|
<v-btn icon="mdi-magnify" variant="text" size="small" class="mr-2"></v-btn>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-divider></v-divider>
|
||||||
|
|
||||||
|
<!-- Контент -->
|
||||||
|
<div class="pa-6">
|
||||||
|
<div class="text-h6 mb-4">Добро пожаловать в раздел "{{ getActiveTitle }}"</div>
|
||||||
|
<v-row>
|
||||||
|
<v-col v-for="n in 6" :key="n" cols="12" md="6" lg="4">
|
||||||
|
<v-card elevation="1" rounded="lg" class="content-card">
|
||||||
|
<v-card-item>
|
||||||
|
<v-card-title>Карточка {{ n }}</v-card-title>
|
||||||
|
<v-card-subtitle>Описание карточки {{ n }}</v-card-subtitle>
|
||||||
|
</v-card-item>
|
||||||
|
<v-card-text>
|
||||||
|
Контент карточки {{ n }}. Здесь может быть любая информация.
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
|
|
||||||
|
const activeItem = ref('Главная')
|
||||||
|
|
||||||
|
const mainMenu = [
|
||||||
|
{ title: 'Главная', icon: 'mdi-home-outline', activeIcon: 'mdi-home' },
|
||||||
|
{ title: 'Профиль', icon: 'mdi-account-outline', activeIcon: 'mdi-account' },
|
||||||
|
{ title: 'Сообщения', icon: 'mdi-message-outline', activeIcon: 'mdi-message', badge: '3' },
|
||||||
|
{ title: 'Файлы', icon: 'mdi-folder-outline', activeIcon: 'mdi-folder' },
|
||||||
|
{ title: 'Аналитика', icon: 'mdi-chart-line', activeIcon: 'mdi-chart-line' },
|
||||||
|
{ title: 'Календарь', icon: 'mdi-calendar-outline', activeIcon: 'mdi-calendar' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const bottomMenu = [
|
||||||
|
{ title: 'Настройки', icon: 'mdi-cog-outline', activeIcon: 'mdi-cog' },
|
||||||
|
{ title: 'Помощь', icon: 'mdi-help-circle-outline', activeIcon: 'mdi-help-circle' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const getActiveTitle = computed(() => {
|
||||||
|
const found = [...mainMenu, ...bottomMenu].find((item) => item.title === activeItem.value)
|
||||||
|
return found ? found.title : 'Главная'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rail-drawer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: none; /* Firefox */
|
||||||
|
-ms-overflow-style: none; /* IE/Edge */
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-drawer::-webkit-scrollbar {
|
||||||
|
display: none; /* Chrome/Safari */
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item {
|
||||||
|
justify-content: center !important;
|
||||||
|
min-height: 48px !important;
|
||||||
|
padding: 0 8px !important;
|
||||||
|
border-radius: 12px !important;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item:hover {
|
||||||
|
background-color: rgba(var(--v-theme-primary), 0.08) !important;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item.active-item {
|
||||||
|
background-color: rgb(var(--v-theme-primary)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item.active-item .v-icon {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item .v-icon {
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rail-list-item:hover .v-icon {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-avatar {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-avatar:hover {
|
||||||
|
transform: rotate(10deg) scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-avatar {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-avatar:hover {
|
||||||
|
border-color: rgb(var(--v-theme-primary));
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-area {
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: rgb(var(--v-theme-background)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-card {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Анимация для тултипов */
|
||||||
|
:deep(.v-tooltip .v-overlay__content) {
|
||||||
|
background-color: rgb(var(--v-theme-primary)) !important;
|
||||||
|
color: white !important;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
padding: 6px 12px !important;
|
||||||
|
border-radius: 8px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
72
src/components/TestMenu2.vue
Normal file
72
src/components/TestMenu2.vue
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<v-container class="d-flex ga-4" style="height: 500px">
|
||||||
|
<!-- Простой rail drawer -->
|
||||||
|
<v-card width="72" height="100%" elevation="0" class="simple-rail">
|
||||||
|
<div class="d-flex flex-column align-center py-4">
|
||||||
|
<v-avatar color="primary" size="40" class="mb-4">
|
||||||
|
<v-icon icon="mdi-vuetify" color="white"></v-icon>
|
||||||
|
</v-avatar>
|
||||||
|
|
||||||
|
<v-divider class="w-100 mb-2"></v-divider>
|
||||||
|
|
||||||
|
<v-list density="compact" nav class="w-100 px-1">
|
||||||
|
<v-list-item
|
||||||
|
v-for="icon in icons"
|
||||||
|
:key="icon.name"
|
||||||
|
:value="icon.name"
|
||||||
|
:active="active === icon.name"
|
||||||
|
@click="active = icon.name"
|
||||||
|
class="simple-item"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<v-icon :icon="icon.icon"></v-icon>
|
||||||
|
</template>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
|
<v-divider class="w-100 my-2"></v-divider>
|
||||||
|
|
||||||
|
<v-avatar size="44" class="mt-2 cursor-pointer" color="grey-lighten-3">
|
||||||
|
<v-img src="https://randomuser.me/api/portraits/men/32.jpg"></v-img>
|
||||||
|
<v-tooltip activator="parent" location="right">Профиль</v-tooltip>
|
||||||
|
</v-avatar>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const active = ref('Главная')
|
||||||
|
const icons = [
|
||||||
|
{ name: 'Главная', icon: 'mdi-home' },
|
||||||
|
{ name: 'Профиль', icon: 'mdi-account' },
|
||||||
|
{ name: 'Сообщения', icon: 'mdi-message' },
|
||||||
|
{ name: 'Настройки', icon: 'mdi-cog' },
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.simple-rail {
|
||||||
|
background-color: rgb(var(--v-theme-surface)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.simple-item {
|
||||||
|
justify-content: center !important;
|
||||||
|
min-height: 44px !important;
|
||||||
|
border-radius: 10px !important;
|
||||||
|
margin: 2px 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.simple-item:hover {
|
||||||
|
background-color: rgba(var(--v-theme-primary), 0.1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.simple-item.v-list-item--active {
|
||||||
|
background-color: rgb(var(--v-theme-primary)) !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
51
src/components/Users/UsersList.vue
Normal file
51
src/components/Users/UsersList.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { SocketDataReq, useSocketsStore } from '@/stores/sockets.ts'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { useUsersStore } from '@/stores/users.ts'
|
||||||
|
import UsersListElement from '@/components/Users/UsersListElement.vue'
|
||||||
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
|
|
||||||
|
const socketsStore = useSocketsStore()
|
||||||
|
const usersStore = useUsersStore()
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
|
function onInit() {
|
||||||
|
socketsStore.send({
|
||||||
|
type: SocketDataReq.GET_USERS,
|
||||||
|
data: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
onInit()
|
||||||
|
})
|
||||||
|
|
||||||
|
function onStartChat(userId: number) {
|
||||||
|
console.log('user', userId)
|
||||||
|
console.log('me', authStore.me?.id)
|
||||||
|
|
||||||
|
socketsStore.send({
|
||||||
|
type: SocketDataReq.CREATE_CHAT,
|
||||||
|
data: {
|
||||||
|
userId: userId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-2 h-full overflow-hidden px-2">
|
||||||
|
<div>contacts</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 h-full overflow-y-auto">
|
||||||
|
<UsersListElement
|
||||||
|
v-for="user in usersStore.users"
|
||||||
|
:key="user.id"
|
||||||
|
v-bind:user="user"
|
||||||
|
@click="onStartChat"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
25
src/components/Users/UsersListElement.vue
Normal file
25
src/components/Users/UsersListElement.vue
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { User } from '@/stores/users.ts'
|
||||||
|
import { JustButton } from '@/components/simple'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
user: User
|
||||||
|
}
|
||||||
|
|
||||||
|
const { user } = defineProps<Props>()
|
||||||
|
const emit = defineEmits<{
|
||||||
|
click: [id: number]
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="border p-2">
|
||||||
|
<!-- <div>log: {{ user }}</div>-->
|
||||||
|
<div>id:{{ user.id }}</div>
|
||||||
|
<div>name:{{ user.name }}</div>
|
||||||
|
<div>email:{{ user.email }}</div>
|
||||||
|
<JustButton @click="emit('click', user.id)">start chat</JustButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue'
|
|
||||||
|
|
||||||
const message = ref('')
|
|
||||||
const selectedChat = ref('')
|
|
||||||
|
|
||||||
// const { messages, chats, isConnected, error, send } = useSharedWebSocket({
|
|
||||||
// onMessage: (data) => {
|
|
||||||
// console.log('Received message:', data)
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
|
|
||||||
const onChatClick = (id: string) => {
|
|
||||||
console.log(id)
|
|
||||||
selectedChat.value = id
|
|
||||||
// send({
|
|
||||||
// type: WsDataType.GET_MESSAGES,
|
|
||||||
// data: { chat_id: id },
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
const sendMessage = () => {
|
|
||||||
if (message.value.trim()) {
|
|
||||||
// send({
|
|
||||||
// type: WsDataType.CREATE_MESSAGE,
|
|
||||||
// data: {
|
|
||||||
// chat_id: selectedChat.value,
|
|
||||||
// text: message.value,
|
|
||||||
// },
|
|
||||||
})
|
|
||||||
message.value = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<!-- <div class="status" :class="{ isConnected, disconnected: !isConnected }">-->
|
|
||||||
<!-- status: {{ isConnected ? 'connected' : 'disconnected' }}-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<div>selected chat {{ selectedChat }}</div>
|
|
||||||
<!-- <div class="error">Error: {{ error }}</div>-->
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<div>
|
|
||||||
<!-- <div v-for="chat in chats" :key="chat.id" @click="onChatClick(chat.id)">-->
|
|
||||||
<!-- <div>{{ chat.id }}</div>-->
|
|
||||||
<!-- <div>{{ chat.users }}</div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</div>
|
|
||||||
</v-col>
|
|
||||||
<v-col>
|
|
||||||
<v-sheet border class="pa-4 border-opacity-50">
|
|
||||||
<div v-if="selectedChat">
|
|
||||||
<v-sheet height="400px" class="overflow-y-auto">
|
|
||||||
<!-- <div v-for="message in messages" :key="message.id">-->
|
|
||||||
<!-- <div>{{ message }}</div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</v-sheet>
|
|
||||||
|
|
||||||
<div class="d-flex align-center ga-1">
|
|
||||||
<v-text-field
|
|
||||||
rounded="lg"
|
|
||||||
hide-details
|
|
||||||
variant="outlined"
|
|
||||||
v-model="message"
|
|
||||||
@keyup.enter="sendMessage"
|
|
||||||
placeholder="Type message..."
|
|
||||||
>
|
|
||||||
</v-text-field>
|
|
||||||
<!-- <v-btn-->
|
|
||||||
<!-- :disabled="!isConnected"-->
|
|
||||||
<!-- variant="elevated"-->
|
|
||||||
<!-- color="primary"-->
|
|
||||||
<!-- icon="mdi-send"-->
|
|
||||||
<!-- @click="sendMessage"-->
|
|
||||||
<!-- />-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</v-sheet>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
9
src/components/simple/JustButton.vue
Normal file
9
src/components/simple/JustButton.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button class="border border-gray-700 rounded-md text-gray-700 px-1.5 py-1.5 flex justify-center">
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
12
src/components/simple/JustInput.vue
Normal file
12
src/components/simple/JustInput.vue
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const model = defineModel()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<input
|
||||||
|
v-model="model"
|
||||||
|
class="border px-2 py-1.5 rounded-md bg-white outline-none focus:outline-none"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
23
src/components/simple/JustList.vue
Normal file
23
src/components/simple/JustList.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, useSlots } from 'vue'
|
||||||
|
|
||||||
|
const model = defineModel('selected')
|
||||||
|
function checkSlots() {
|
||||||
|
const slots = useSlots()
|
||||||
|
console.log('slots')
|
||||||
|
if (slots.default) {
|
||||||
|
// console.log('default slot', slots.default())
|
||||||
|
|
||||||
|
const a = slots.default().map((el) => el)
|
||||||
|
console.log('a', a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
21
src/components/simple/JustListItem.vue
Normal file
21
src/components/simple/JustListItem.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import JustButton from '@/components/simple/JustButton.vue'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
icon: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const { icon, value } = defineProps<Props>()
|
||||||
|
const emit = defineEmits<{
|
||||||
|
click: [value: string]
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<JustButton @click="emit('click', value)">
|
||||||
|
<span class="mdi text-2xl" :class="icon"></span>
|
||||||
|
</JustButton>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
9
src/components/simple/JustNav.vue
Normal file
9
src/components/simple/JustNav.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="w-16 flex flex-col gap-2 items-stretch p-1 border">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
22
src/components/simple/JustTest.vue
Normal file
22
src/components/simple/JustTest.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
interface Props {
|
||||||
|
text: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const { text, value } = defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
click: [value: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function onClick() {
|
||||||
|
emit('click', value)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-2 border" @click="onClick">{{ text }} - {{ value }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
8
src/components/simple/index.ts
Normal file
8
src/components/simple/index.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import JustInput from '@/components/simple/JustInput.vue'
|
||||||
|
import JustButton from '@/components/simple/JustButton.vue'
|
||||||
|
import JustList from '@/components/simple/JustList.vue'
|
||||||
|
import JustListItem from '@/components/simple/JustListItem.vue'
|
||||||
|
import JustNav from '@/components/simple/JustNav.vue'
|
||||||
|
import JustTest from '@/components/simple/JustTest.vue'
|
||||||
|
|
||||||
|
export { JustInput, JustButton, JustList, JustListItem, JustNav, JustTest }
|
||||||
459
src/composables/useLayout.ts
Normal file
459
src/composables/useLayout.ts
Normal file
@@ -0,0 +1,459 @@
|
|||||||
|
import { updatePrimaryPalette, updateSurfacePalette } from '@primeuix/themes'
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
|
const appState = ref({
|
||||||
|
primary: 'black',
|
||||||
|
surface: '',
|
||||||
|
darkMode: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const primaryColors = ref([
|
||||||
|
{
|
||||||
|
name: 'emerald',
|
||||||
|
palette: {
|
||||||
|
50: '#ecfdf5',
|
||||||
|
100: '#d1fae5',
|
||||||
|
200: '#a7f3d0',
|
||||||
|
300: '#6ee7b7',
|
||||||
|
400: '#34d399',
|
||||||
|
500: '#10b981',
|
||||||
|
600: '#059669',
|
||||||
|
700: '#047857',
|
||||||
|
800: '#065f46',
|
||||||
|
900: '#064e3b',
|
||||||
|
950: '#022c22',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'green',
|
||||||
|
palette: {
|
||||||
|
50: '#f0fdf4',
|
||||||
|
100: '#dcfce7',
|
||||||
|
200: '#bbf7d0',
|
||||||
|
300: '#86efac',
|
||||||
|
400: '#4ade80',
|
||||||
|
500: '#22c55e',
|
||||||
|
600: '#16a34a',
|
||||||
|
700: '#15803d',
|
||||||
|
800: '#166534',
|
||||||
|
900: '#14532d',
|
||||||
|
950: '#052e16',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'lime',
|
||||||
|
palette: {
|
||||||
|
50: '#f7fee7',
|
||||||
|
100: '#ecfccb',
|
||||||
|
200: '#d9f99d',
|
||||||
|
300: '#bef264',
|
||||||
|
400: '#a3e635',
|
||||||
|
500: '#84cc16',
|
||||||
|
600: '#65a30d',
|
||||||
|
700: '#4d7c0f',
|
||||||
|
800: '#3f6212',
|
||||||
|
900: '#365314',
|
||||||
|
950: '#1a2e05',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'orange',
|
||||||
|
palette: {
|
||||||
|
50: '#fff7ed',
|
||||||
|
100: '#ffedd5',
|
||||||
|
200: '#fed7aa',
|
||||||
|
300: '#fdba74',
|
||||||
|
400: '#fb923c',
|
||||||
|
500: '#f97316',
|
||||||
|
600: '#ea580c',
|
||||||
|
700: '#c2410c',
|
||||||
|
800: '#9a3412',
|
||||||
|
900: '#7c2d12',
|
||||||
|
950: '#431407',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'amber',
|
||||||
|
palette: {
|
||||||
|
50: '#fffbeb',
|
||||||
|
100: '#fef3c7',
|
||||||
|
200: '#fde68a',
|
||||||
|
300: '#fcd34d',
|
||||||
|
400: '#fbbf24',
|
||||||
|
500: '#f59e0b',
|
||||||
|
600: '#d97706',
|
||||||
|
700: '#b45309',
|
||||||
|
800: '#92400e',
|
||||||
|
900: '#78350f',
|
||||||
|
950: '#451a03',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'yellow',
|
||||||
|
palette: {
|
||||||
|
50: '#fefce8',
|
||||||
|
100: '#fef9c3',
|
||||||
|
200: '#fef08a',
|
||||||
|
300: '#fde047',
|
||||||
|
400: '#facc15',
|
||||||
|
500: '#eab308',
|
||||||
|
600: '#ca8a04',
|
||||||
|
700: '#a16207',
|
||||||
|
800: '#854d0e',
|
||||||
|
900: '#713f12',
|
||||||
|
950: '#422006',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'teal',
|
||||||
|
palette: {
|
||||||
|
50: '#f0fdfa',
|
||||||
|
100: '#ccfbf1',
|
||||||
|
200: '#99f6e4',
|
||||||
|
300: '#5eead4',
|
||||||
|
400: '#2dd4bf',
|
||||||
|
500: '#14b8a6',
|
||||||
|
600: '#0d9488',
|
||||||
|
700: '#0f766e',
|
||||||
|
800: '#115e59',
|
||||||
|
900: '#134e4a',
|
||||||
|
950: '#042f2e',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cyan',
|
||||||
|
palette: {
|
||||||
|
50: '#ecfeff',
|
||||||
|
100: '#cffafe',
|
||||||
|
200: '#a5f3fc',
|
||||||
|
300: '#67e8f9',
|
||||||
|
400: '#22d3ee',
|
||||||
|
500: '#06b6d4',
|
||||||
|
600: '#0891b2',
|
||||||
|
700: '#0e7490',
|
||||||
|
800: '#155e75',
|
||||||
|
900: '#164e63',
|
||||||
|
950: '#083344',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'sky',
|
||||||
|
palette: {
|
||||||
|
50: '#f0f9ff',
|
||||||
|
100: '#e0f2fe',
|
||||||
|
200: '#bae6fd',
|
||||||
|
300: '#7dd3fc',
|
||||||
|
400: '#38bdf8',
|
||||||
|
500: '#0ea5e9',
|
||||||
|
600: '#0284c7',
|
||||||
|
700: '#0369a1',
|
||||||
|
800: '#075985',
|
||||||
|
900: '#0c4a6e',
|
||||||
|
950: '#082f49',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'blue',
|
||||||
|
palette: {
|
||||||
|
50: '#eff6ff',
|
||||||
|
100: '#dbeafe',
|
||||||
|
200: '#bfdbfe',
|
||||||
|
300: '#93c5fd',
|
||||||
|
400: '#60a5fa',
|
||||||
|
500: '#3b82f6',
|
||||||
|
600: '#2563eb',
|
||||||
|
700: '#1d4ed8',
|
||||||
|
800: '#1e40af',
|
||||||
|
900: '#1e3a8a',
|
||||||
|
950: '#172554',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'indigo',
|
||||||
|
palette: {
|
||||||
|
50: '#eef2ff',
|
||||||
|
100: '#e0e7ff',
|
||||||
|
200: '#c7d2fe',
|
||||||
|
300: '#a5b4fc',
|
||||||
|
400: '#818cf8',
|
||||||
|
500: '#6366f1',
|
||||||
|
600: '#4f46e5',
|
||||||
|
700: '#4338ca',
|
||||||
|
800: '#3730a3',
|
||||||
|
900: '#312e81',
|
||||||
|
950: '#1e1b4b',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'violet',
|
||||||
|
palette: {
|
||||||
|
50: '#f5f3ff',
|
||||||
|
100: '#ede9fe',
|
||||||
|
200: '#ddd6fe',
|
||||||
|
300: '#c4b5fd',
|
||||||
|
400: '#a78bfa',
|
||||||
|
500: '#8b5cf6',
|
||||||
|
600: '#7c3aed',
|
||||||
|
700: '#6d28d9',
|
||||||
|
800: '#5b21b6',
|
||||||
|
900: '#4c1d95',
|
||||||
|
950: '#2e1065',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'purple',
|
||||||
|
palette: {
|
||||||
|
50: '#faf5ff',
|
||||||
|
100: '#f3e8ff',
|
||||||
|
200: '#e9d5ff',
|
||||||
|
300: '#d8b4fe',
|
||||||
|
400: '#c084fc',
|
||||||
|
500: '#a855f7',
|
||||||
|
600: '#9333ea',
|
||||||
|
700: '#7e22ce',
|
||||||
|
800: '#6b21a8',
|
||||||
|
900: '#581c87',
|
||||||
|
950: '#3b0764',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'fuchsia',
|
||||||
|
palette: {
|
||||||
|
50: '#fdf4ff',
|
||||||
|
100: '#fae8ff',
|
||||||
|
200: '#f5d0fe',
|
||||||
|
300: '#f0abfc',
|
||||||
|
400: '#e879f9',
|
||||||
|
500: '#d946ef',
|
||||||
|
600: '#c026d3',
|
||||||
|
700: '#a21caf',
|
||||||
|
800: '#86198f',
|
||||||
|
900: '#701a75',
|
||||||
|
950: '#4a044e',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pink',
|
||||||
|
palette: {
|
||||||
|
50: '#fdf2f8',
|
||||||
|
100: '#fce7f3',
|
||||||
|
200: '#fbcfe8',
|
||||||
|
300: '#f9a8d4',
|
||||||
|
400: '#f472b6',
|
||||||
|
500: '#ec4899',
|
||||||
|
600: '#db2777',
|
||||||
|
700: '#be185d',
|
||||||
|
800: '#9d174d',
|
||||||
|
900: '#831843',
|
||||||
|
950: '#500724',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rose',
|
||||||
|
palette: {
|
||||||
|
50: '#fff1f2',
|
||||||
|
100: '#ffe4e6',
|
||||||
|
200: '#fecdd3',
|
||||||
|
300: '#fda4af',
|
||||||
|
400: '#fb7185',
|
||||||
|
500: '#f43f5e',
|
||||||
|
600: '#e11d48',
|
||||||
|
700: '#be123c',
|
||||||
|
800: '#9f1239',
|
||||||
|
900: '#881337',
|
||||||
|
950: '#4c0519',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const surfaces = ref([
|
||||||
|
{
|
||||||
|
name: 'slate',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#f8fafc',
|
||||||
|
100: '#f1f5f9',
|
||||||
|
200: '#e2e8f0',
|
||||||
|
300: '#cbd5e1',
|
||||||
|
400: '#94a3b8',
|
||||||
|
500: '#64748b',
|
||||||
|
600: '#475569',
|
||||||
|
700: '#334155',
|
||||||
|
800: '#1e293b',
|
||||||
|
900: '#0f172a',
|
||||||
|
950: '#020617',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'gray',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#f9fafb',
|
||||||
|
100: '#f3f4f6',
|
||||||
|
200: '#e5e7eb',
|
||||||
|
300: '#d1d5db',
|
||||||
|
400: '#9ca3af',
|
||||||
|
500: '#6b7280',
|
||||||
|
600: '#4b5563',
|
||||||
|
700: '#374151',
|
||||||
|
800: '#1f2937',
|
||||||
|
900: '#111827',
|
||||||
|
950: '#030712',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'zinc',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#fafafa',
|
||||||
|
100: '#f4f4f5',
|
||||||
|
200: '#e4e4e7',
|
||||||
|
300: '#d4d4d8',
|
||||||
|
400: '#a1a1aa',
|
||||||
|
500: '#71717a',
|
||||||
|
600: '#52525b',
|
||||||
|
700: '#3f3f46',
|
||||||
|
800: '#27272a',
|
||||||
|
900: '#18181b',
|
||||||
|
950: '#09090b',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'neutral',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#fafafa',
|
||||||
|
100: '#f5f5f5',
|
||||||
|
200: '#e5e5e5',
|
||||||
|
300: '#d4d4d4',
|
||||||
|
400: '#a3a3a3',
|
||||||
|
500: '#737373',
|
||||||
|
600: '#525252',
|
||||||
|
700: '#404040',
|
||||||
|
800: '#262626',
|
||||||
|
900: '#171717',
|
||||||
|
950: '#0a0a0a',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'stone',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#fafaf9',
|
||||||
|
100: '#f5f5f4',
|
||||||
|
200: '#e7e5e4',
|
||||||
|
300: '#d6d3d1',
|
||||||
|
400: '#a8a29e',
|
||||||
|
500: '#78716c',
|
||||||
|
600: '#57534e',
|
||||||
|
700: '#44403c',
|
||||||
|
800: '#292524',
|
||||||
|
900: '#1c1917',
|
||||||
|
950: '#0c0a09',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'soho',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#f4f4f4',
|
||||||
|
100: '#e8e9e9',
|
||||||
|
200: '#d2d2d4',
|
||||||
|
300: '#bbbcbe',
|
||||||
|
400: '#a5a5a9',
|
||||||
|
500: '#8e8f93',
|
||||||
|
600: '#77787d',
|
||||||
|
700: '#616268',
|
||||||
|
800: '#4a4b52',
|
||||||
|
900: '#34343d',
|
||||||
|
950: '#1d1e27',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'viva',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#f3f3f3',
|
||||||
|
100: '#e7e7e8',
|
||||||
|
200: '#cfd0d0',
|
||||||
|
300: '#b7b8b9',
|
||||||
|
400: '#9fa1a1',
|
||||||
|
500: '#87898a',
|
||||||
|
600: '#6e7173',
|
||||||
|
700: '#565a5b',
|
||||||
|
800: '#3e4244',
|
||||||
|
900: '#262b2c',
|
||||||
|
950: '#0e1315',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ocean',
|
||||||
|
palette: {
|
||||||
|
0: '#ffffff',
|
||||||
|
50: '#fbfcfc',
|
||||||
|
100: '#F7F9F8',
|
||||||
|
200: '#EFF3F2',
|
||||||
|
300: '#DADEDD',
|
||||||
|
400: '#B1B7B6',
|
||||||
|
500: '#828787',
|
||||||
|
600: '#5F7274',
|
||||||
|
700: '#415B61',
|
||||||
|
800: '#29444E',
|
||||||
|
900: '#183240',
|
||||||
|
950: '#0c1920',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
export function useLayout() {
|
||||||
|
function setPrimary(value: string) {
|
||||||
|
appState.value.primary = value
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSurface(value: string) {
|
||||||
|
appState.value.surface = value
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDarkMode(value: boolean) {
|
||||||
|
appState.value.darkMode = value
|
||||||
|
if (value) {
|
||||||
|
document.documentElement.classList.add('p-dark')
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('p-dark')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleDarkMode() {
|
||||||
|
appState.value.darkMode = !appState.value.darkMode
|
||||||
|
document.documentElement.classList.toggle('p-dark')
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateColors(type: string, colorName: string) {
|
||||||
|
if (type === 'primary') {
|
||||||
|
setPrimary(colorName)
|
||||||
|
const color = primaryColors.value.find((c) => c.name === colorName)
|
||||||
|
updatePrimaryPalette(color?.palette)
|
||||||
|
} else if (type === 'surface') {
|
||||||
|
setSurface(colorName)
|
||||||
|
const surfaceColor = surfaces.value.find((s) => s.name === colorName)
|
||||||
|
updateSurfacePalette(surfaceColor?.palette)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isDarkMode = computed(() => appState.value.darkMode)
|
||||||
|
const primary = computed(() => appState.value.primary)
|
||||||
|
const surface = computed(() => appState.value.surface)
|
||||||
|
|
||||||
|
return {
|
||||||
|
primaryColors,
|
||||||
|
surfaces,
|
||||||
|
isDarkMode,
|
||||||
|
primary,
|
||||||
|
surface,
|
||||||
|
toggleDarkMode,
|
||||||
|
setDarkMode,
|
||||||
|
setPrimary,
|
||||||
|
setSurface,
|
||||||
|
updateColors,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
import { ref, onUnmounted, onMounted } from 'vue'
|
|
||||||
|
|
||||||
export interface Message {
|
|
||||||
id: number
|
|
||||||
text: string
|
|
||||||
userId: string
|
|
||||||
createdAt: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Chat {
|
|
||||||
id: string
|
|
||||||
type_id: number
|
|
||||||
users: User[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface User {
|
|
||||||
id: number
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WsData {
|
|
||||||
type: WsDataType2
|
|
||||||
// data: Chat | Message | User | User[] | Message[] | Chat[]
|
|
||||||
data: unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum WsDataType2 {
|
|
||||||
GET_CHATS = 'GET_CHATS',
|
|
||||||
GET_USERS = 'GET_USERS',
|
|
||||||
GET_MESSAGES = 'GET_MESSAGES',
|
|
||||||
CREATE_MESSAGE = 'CREATE_MESSAGE',
|
|
||||||
CHATS = 'CHATS',
|
|
||||||
USER = 'USER',
|
|
||||||
MESSAGES = 'MESSAGES',
|
|
||||||
STATUS = 'STATUS',
|
|
||||||
ERROR = 'ERROR',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum COMMAND2 {
|
|
||||||
CONNECT = 'CONNECT',
|
|
||||||
SEND = 'SEND',
|
|
||||||
CLOSE = 'CLOSE',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useSharedWebSocket(options?: { url?: string; autoConnect?: true }) {
|
|
||||||
const url = options?.url || 'ws://localhost:3000/ws'
|
|
||||||
const autoConnect = options?.autoConnect ?? false
|
|
||||||
const messages = ref<Message[]>([])
|
|
||||||
const chats = ref<Chat[]>([])
|
|
||||||
const users = ref<unknown[]>([])
|
|
||||||
const isConnected = ref(false)
|
|
||||||
const error = ref<string>()
|
|
||||||
const worker = ref<SharedWorker>()
|
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
console.log('INIT WORKER')
|
|
||||||
|
|
||||||
if (!window.SharedWorker) {
|
|
||||||
console.log('SharedWorker not supported')
|
|
||||||
error.value = 'SharedWorker not supported'
|
|
||||||
}
|
|
||||||
|
|
||||||
worker.value = new SharedWorker(new URL('@/workers/worker.js', import.meta.url), {
|
|
||||||
type: 'module',
|
|
||||||
})
|
|
||||||
|
|
||||||
worker.value.port.onmessage = (event) => {
|
|
||||||
const { type, data, connected, message } = event.data
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case WsDataType2.USER:
|
|
||||||
break
|
|
||||||
case WsDataType2.CHATS:
|
|
||||||
chats.value = data
|
|
||||||
break
|
|
||||||
case WsDataType2.MESSAGES:
|
|
||||||
messages.value = data
|
|
||||||
// if (options.onMessage) {
|
|
||||||
// options.onMessage(data)
|
|
||||||
// }
|
|
||||||
break
|
|
||||||
case WsDataType2.CREATE_MESSAGE:
|
|
||||||
messages.value.push(data)
|
|
||||||
break
|
|
||||||
case WsDataType2.STATUS:
|
|
||||||
isConnected.value = connected
|
|
||||||
break
|
|
||||||
case WsDataType2.ERROR:
|
|
||||||
error.value = message
|
|
||||||
logout()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
worker.value.port.postMessage({
|
|
||||||
command: COMMAND2.CONNECT,
|
|
||||||
data: { url: url, token: getToken() },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function logout() {
|
|
||||||
return localStorage.removeItem('token')
|
|
||||||
}
|
|
||||||
|
|
||||||
function getToken() {
|
|
||||||
return localStorage.getItem('token')
|
|
||||||
}
|
|
||||||
|
|
||||||
const send = (data: WsData) => {
|
|
||||||
if (worker.value) {
|
|
||||||
worker.value.port.postMessage({
|
|
||||||
command: COMMAND2.SEND,
|
|
||||||
data: data,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const close = () => {
|
|
||||||
if (worker.value) {
|
|
||||||
worker.value.port.postMessage({ command: COMMAND2.CLOSE })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
if (autoConnect) init()
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
if (worker.value) close()
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
messages,
|
|
||||||
chats,
|
|
||||||
isConnected,
|
|
||||||
error,
|
|
||||||
send,
|
|
||||||
close,
|
|
||||||
init,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
30
src/main.ts
30
src/main.ts
@@ -1,28 +1,28 @@
|
|||||||
import '@fontsource/roboto/100.css'
|
|
||||||
import '@fontsource/roboto/300.css'
|
|
||||||
import '@fontsource/roboto/400.css'
|
|
||||||
import '@mdi/font/css/materialdesignicons.css'
|
import '@mdi/font/css/materialdesignicons.css'
|
||||||
|
import './assets/main.css'
|
||||||
|
import './assets/default.css'
|
||||||
|
import './assets/custom.css'
|
||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import App from './App.vue'
|
import PrimeVue from 'primevue/config'
|
||||||
|
import Aura from '@primeuix/themes/aura'
|
||||||
|
|
||||||
import 'vuetify/styles'
|
import App from './App.vue'
|
||||||
import { createVuetify } from 'vuetify'
|
import { version } from 'vue'
|
||||||
import * as components from 'vuetify/components'
|
|
||||||
import * as directives from 'vuetify/directives'
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(createPinia())
|
console.log('version', version)
|
||||||
|
|
||||||
const vuetify = createVuetify({
|
app.use(PrimeVue, {
|
||||||
components,
|
theme: {
|
||||||
directives,
|
preset: Aura,
|
||||||
icons: {
|
options: {
|
||||||
defaultSet: 'mdi',
|
darkModeSelector: '.p-dark',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
app.use(vuetify)
|
app.use(createPinia())
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import type { WsData } from '@/composables/useSharedWebSocket.ts'
|
|
||||||
import type { User } from '@/stores/users.ts'
|
import type { User } from '@/stores/users.ts'
|
||||||
|
|
||||||
export const useAuthStore = defineStore('auth', () => {
|
export const useAuthStore = defineStore('auth', () => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { onMounted, onUnmounted, ref } from 'vue'
|
|||||||
import { type Chat, useChatsStore } from '@/stores/chats.ts'
|
import { type Chat, useChatsStore } from '@/stores/chats.ts'
|
||||||
import { useAuthStore } from '@/stores/auth.ts'
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
import { type Message, useMessagesStore } from '@/stores/messages.ts'
|
import { type Message, useMessagesStore } from '@/stores/messages.ts'
|
||||||
|
import { useUsersStore } from '@/stores/users.ts'
|
||||||
|
|
||||||
export enum SocketDataReq {
|
export enum SocketDataReq {
|
||||||
GET_CHATS = 'GET_CHATS',
|
GET_CHATS = 'GET_CHATS',
|
||||||
@@ -35,6 +36,7 @@ export const useSocketsStore = defineStore('sockets', () => {
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const chatsStore = useChatsStore()
|
const chatsStore = useChatsStore()
|
||||||
const messagesStore = useMessagesStore()
|
const messagesStore = useMessagesStore()
|
||||||
|
const usersStore = useUsersStore()
|
||||||
|
|
||||||
const isConnected = ref(false)
|
const isConnected = ref(false)
|
||||||
const error = ref<string>()
|
const error = ref<string>()
|
||||||
@@ -57,27 +59,30 @@ export const useSocketsStore = defineStore('sockets', () => {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SocketDataRes.USERS:
|
case SocketDataRes.USERS:
|
||||||
console.log('USERS_LIST', data)
|
usersStore.users = data
|
||||||
break
|
break
|
||||||
case SocketDataRes.USER:
|
case SocketDataRes.USER:
|
||||||
console.log('USER', data)
|
|
||||||
authStore.me = data
|
authStore.me = data
|
||||||
break
|
break
|
||||||
case SocketDataRes.CHATS:
|
case SocketDataRes.CHATS:
|
||||||
console.log('CHATS', data)
|
if (Array.isArray(data)) {
|
||||||
chatsStore.chats = data
|
chatsStore.chats = data
|
||||||
|
} else {
|
||||||
|
console.log(data)
|
||||||
|
const idx = chatsStore.chats.findIndex((chat) => chat.id === data.id)
|
||||||
|
console.log(idx)
|
||||||
|
if (idx < 0) chatsStore.chats.push(data)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case SocketDataRes.MESSAGES:
|
case SocketDataRes.MESSAGES:
|
||||||
console.log('MESSAGES', data)
|
messagesStore.messages = data
|
||||||
|
|
||||||
messagesStore.messages = data.reverse()
|
|
||||||
// if (options.onMessage) {
|
// if (options.onMessage) {
|
||||||
// options.onMessage(data)
|
// options.onMessage(data)
|
||||||
// }
|
// }
|
||||||
break
|
break
|
||||||
case SocketDataRes.MESSAGE:
|
case SocketDataRes.MESSAGE:
|
||||||
console.log('MESSAGE', data)
|
messagesStore.messages.unshift(data)
|
||||||
messagesStore.messages.push(data)
|
|
||||||
break
|
break
|
||||||
case SocketDataRes.STATUS:
|
case SocketDataRes.STATUS:
|
||||||
isConnected.value = connected
|
isConnected.value = connected
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { onMounted, ref } from 'vue'
|
|
||||||
import ChatsPane from '@/components/ChatsPane.vue'
|
|
||||||
import MessagesPane from '@/components/MessagesPane.vue'
|
|
||||||
import { useSocketsStore } from '@/stores/sockets.ts'
|
|
||||||
import { useChatsStore } from '@/stores/chats.ts'
|
|
||||||
|
|
||||||
const socketsStore = useSocketsStore()
|
|
||||||
// const { messages, chats, isConnected, error, send } = useSharedWebSocket({ autoConnect: true })
|
|
||||||
|
|
||||||
// const socketsStore = useSocketsStore()
|
|
||||||
|
|
||||||
const chatsStore = useChatsStore()
|
|
||||||
|
|
||||||
const message = ref('')
|
|
||||||
const selectedChat = ref('')
|
|
||||||
|
|
||||||
// const onChatClick = (id: string) => {
|
|
||||||
// console.log(id)
|
|
||||||
// selectedChat.value = id
|
|
||||||
// send({
|
|
||||||
// type: WsDataType.GET_MESSAGES,
|
|
||||||
// data: { chat_id: id },
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const sendMessage = () => {
|
|
||||||
// if (message.value.trim()) {
|
|
||||||
// send({
|
|
||||||
// type: WsDataType.CREATE_MESSAGE,
|
|
||||||
// data: {
|
|
||||||
// chat_id: selectedChat.value,
|
|
||||||
// text: message.value,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// message.value = ''
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
onMounted(() => {
|
|
||||||
socketsStore.init()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<v-row no-gutters class="h-100">
|
|
||||||
<v-col cols="12" md="4" lg="3" sm="5">
|
|
||||||
<chats-pane />
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" md="8" lg="9" sm="7" class="h-100">
|
|
||||||
<messages-pane v-if="chatsStore.selected" />
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
47
src/views/MainView.vue
Normal file
47
src/views/MainView.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
import { useSocketsStore } from '@/stores/sockets.ts'
|
||||||
|
import AppMenu from '@/components/AppMenu.vue'
|
||||||
|
import LeftPane from '@/components/LeftPane.vue'
|
||||||
|
import RightPane from '@/components/RightPane.vue'
|
||||||
|
import UsersList from '@/components/Users/UsersList.vue'
|
||||||
|
import SettingsList from '@/components/Settings/SettingsList.vue'
|
||||||
|
import ChatsList from '@/components/Chats/ChatsList.vue'
|
||||||
|
|
||||||
|
const socketsStore = useSocketsStore()
|
||||||
|
|
||||||
|
type MenuSelected = 'chats' | 'users' | 'settings'
|
||||||
|
|
||||||
|
const selected = ref<MenuSelected>()
|
||||||
|
|
||||||
|
const component = computed(() => {
|
||||||
|
switch (selected.value) {
|
||||||
|
case 'chats':
|
||||||
|
return ChatsList
|
||||||
|
case 'users':
|
||||||
|
return UsersList
|
||||||
|
case 'settings':
|
||||||
|
return SettingsList
|
||||||
|
default:
|
||||||
|
return ChatsList
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
socketsStore.init()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex h-full">
|
||||||
|
<div class="flex w-full">
|
||||||
|
<AppMenu v-model="selected" />
|
||||||
|
<LeftPane>
|
||||||
|
<component :is="component" />
|
||||||
|
</LeftPane>
|
||||||
|
</div>
|
||||||
|
<RightPane />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,41 +1,33 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useAuthStore } from '@/stores/auth.ts'
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
|
import { JustButton, JustInput } from '@/components/simple'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
const email = ref('vadim.olonin@gmail.com')
|
const email = ref('vadim.olonin@gmail.com')
|
||||||
|
const name = ref('')
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
await authStore.login(email.value)
|
await authStore.login(email.value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-row justify="center" align="center" class="h-100">
|
<div class="h-full flex flex-col justify-center items-center">
|
||||||
<v-col cols="12" md="4" lg="4">
|
<div class="bg-white border border-gray-500 p-4 rounded-md w-64">
|
||||||
<v-card elevation="0" border rounded="lg">
|
|
||||||
<v-card-title class="mb-2">Sign in</v-card-title>
|
|
||||||
<v-card-text>
|
|
||||||
<form @submit.prevent="onSubmit">
|
<form @submit.prevent="onSubmit">
|
||||||
<div class="d-flex flex-column ga-4">
|
<div class="flex flex-col gap-2">
|
||||||
<v-text-field
|
<div class="">Sign in</div>
|
||||||
hide-details
|
<JustInput v-model="email" placeholder="email" type="email" class="" />
|
||||||
variant="outlined"
|
<input v-if="false" v-model="name" placeholder="name" />
|
||||||
v-model="email"
|
<div class="flex justify-end">
|
||||||
placeholder="email"
|
<input type="checkbox" v-if="false" />
|
||||||
type="email"
|
<JustButton type="submit">sign in</JustButton>
|
||||||
rounded="lg"
|
|
||||||
/>
|
|
||||||
<div class="d-flex ga-4 align-center justify-space-between">
|
|
||||||
<v-switch color="black" label="Keep me signed in" hide-details></v-switch>
|
|
||||||
<v-btn variant="flat" rounded="lg" type="submit" color="black">login</v-btn>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</v-card-text>
|
</div>
|
||||||
</v-card>
|
</div>
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
32
src/views/SignInView2.vue
Normal file
32
src/views/SignInView2.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { useAuthStore } from '@/stores/auth.ts'
|
||||||
|
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
|
const email = ref('vadim.olonin@gmail.com')
|
||||||
|
const name = ref('')
|
||||||
|
async function onSubmit() {
|
||||||
|
await authStore.login(email.value)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="h-100 d-flex flex-column align-center justify-center red">
|
||||||
|
<div class="w-20r border pa-4 blue">
|
||||||
|
<form @submit.prevent="onSubmit">
|
||||||
|
<div class="d-flex flex-column ga-4">
|
||||||
|
<div class="">Sign in</div>
|
||||||
|
<input v-model="email" placeholder="email" type="email" class="border" />
|
||||||
|
<input v-if="false" v-model="name" placeholder="name" />
|
||||||
|
<div class="d-flex ga-4 align-center">
|
||||||
|
<input type="checkbox" v-if="false" />
|
||||||
|
<button type="submit">login</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
17
src/views/TestView.vue
Normal file
17
src/views/TestView.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { JustButton, JustInput } from '@/components/simple'
|
||||||
|
|
||||||
|
const email = ref('test')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex gap-1 h-full w-full bg-green-200 items-start">
|
||||||
|
<JustInput v-model="email" placeholder="email" type="email" />
|
||||||
|
<JustInput placeholder="email" type="email" />
|
||||||
|
|
||||||
|
<JustButton>sign in</JustButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
@@ -6,10 +7,7 @@ import vueDevTools from 'vite-plugin-vue-devtools'
|
|||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [vue(), tailwindcss(), vueDevTools()],
|
||||||
vue(),
|
|
||||||
// vueDevTools(),
|
|
||||||
],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||||
|
|||||||
Reference in New Issue
Block a user