-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from fiit-tp7-2023/#312-message-component
AB#312 Message component
- Loading branch information
Showing
22 changed files
with
449 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<div class="flex w-full h-12 bg-slate-300 text-xl items-center pl-5 rounded-md my-2"> | ||
{{ user?.username ?? user?.address ?? 'Missing user info' }} | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { User } from '~/types/dtos'; | ||
defineProps({ | ||
user: { | ||
type: Object as PropType<User | null>, | ||
required: true, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<nuxt-link :to="'/chat/' + user.address"> | ||
<span | ||
class="hidden w-0 md:flex md:gap-2 md:px-2 md:text-xl md:items-center md:justify-start md:w-full md:h-10" | ||
:class="{ 'bg-slate-300': selected }" | ||
> | ||
<div class="w-5 h-5 bg-slate-500 rounded-full"></div> | ||
<p>{{ user.username ?? user.address }}</p> | ||
</span> | ||
|
||
<span class="md:hidden md:w-0 flex justify-end w-full h-10 gap-1 px-3"> | ||
<p | ||
class="w-8 h-8 flex justify-center items-center bg-slate-200 rounded-full" | ||
:class="{ 'bg-slate-400': selected }" | ||
> | ||
{{ (user.username ?? user.address)?.charAt(0) }} | ||
</p> | ||
</span> | ||
</nuxt-link> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { User } from '~/types/dtos'; | ||
defineProps({ | ||
user: { | ||
type: Object as PropType<User>, | ||
required: true, | ||
}, | ||
selected: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="w-full flex justify-between rounded px-2 py-2" :class="[mine ? 'bg-blue-400' : 'bg-white']"> | ||
<p>{{ message.text }}</p> | ||
<span v-if="message.likes" class="flex justify-end gap-1 items-center"> | ||
<Icon name="mdi:heart" /> | ||
<p v-if="message.likes > 1">{{ message.likes }}</p> | ||
</span> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { type Message } from '~/types/dtos'; | ||
defineProps({ | ||
message: { | ||
type: Object as PropType<Message>, | ||
required: true, | ||
}, | ||
mine: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div class="h-full border-r my-2 border-gray-400 md:p-2"> | ||
<ul class="flex flex-col items-start"> | ||
<li v-for="user in users" :key="user.address" class="w-full"> | ||
<contact-row :user="user" :selected="user.address == $route.params.address" /> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import ContactRow from '~/components/chat/ContactRow.vue'; | ||
import { useUsersStore } from '~/store'; | ||
const usersStore = useUsersStore(); | ||
const users = computed(() => usersStore.users); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<n-layout class="h-screen"> | ||
<n-layout-header> <navigation-component /> </n-layout-header> | ||
<n-layout-content has-sider content-class="content-style"> | ||
<n-layout-sider> | ||
<left-side-chat /> | ||
</n-layout-sider> | ||
<div class="w-full h-full px-4"> | ||
<slot /> | ||
</div> | ||
</n-layout-content> | ||
<n-layout-footer> | ||
<footer-component /> | ||
</n-layout-footer> | ||
</n-layout> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import NavigationComponent from '~/components/layout/NavigationComponent.vue'; | ||
import FooterComponent from '~/components/layout/FooterComponent.vue'; | ||
import LeftSideChat from '~/components/layout/LeftSideChat.vue'; | ||
</script> | ||
|
||
<style scoped> | ||
.n-layout-header, | ||
.n-layout-content, | ||
.n-layout-footer { | ||
padding: 0; | ||
background-color: inherit; | ||
} | ||
:deep(.content-style) { | ||
min-height: calc(100vh - 120px); | ||
} | ||
.n-layout-sider { | ||
@apply w-[60px] md:w-[300px] !important; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.