-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(slimbar): create unread user component
- Loading branch information
Sasha Zakablukov
authored and
Sasha Zakablukov
committed
Mar 23, 2022
1 parent
d78744d
commit c3adc6c
Showing
11 changed files
with
148 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div | ||
class="has-tooltip-right has-tooltip-primary unread" | ||
:data-tooltip="user.name" | ||
@contextmenu="contextMenu" | ||
v-on:click="navigateToUser" | ||
> | ||
<UiCircle | ||
:type="src ? 'image' : 'random'" | ||
:seed="user.address" | ||
:source="src" | ||
:size="40" | ||
/> | ||
<span class="unread-label" v-if="user.unreadCount > 0">{{user.unreadCount > 99 ? "99+" : user.unreadCount}}</span> | ||
</div> |
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,29 @@ | ||
.unread{ | ||
position: relative; | ||
cursor: pointer; | ||
&-label { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
font-size: @micro-text-size; | ||
&:extend(.background-primary); | ||
border-radius: 20px; | ||
line-height: 1; | ||
padding: 0.16rem 0.33rem; | ||
&:extend(.font-primary); | ||
font-family: @primary-font; | ||
border: 2px solid @darker; | ||
} | ||
.circle{ | ||
transition: 0.2s ease-in-out; | ||
} | ||
&:hover{ | ||
.circle{ | ||
border: 3px solid @purple; | ||
} | ||
} | ||
} |
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,64 @@ | ||
<template src="./Unread.html"></template> | ||
|
||
<script lang="ts"> | ||
import Vue, { PropType } from 'vue' | ||
import { User } from '~/types/ui/user' | ||
import ContextMenu from '~/components/mixins/UI/ContextMenu' | ||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
testFunc: () => void | ||
navigateToUser: () => void | ||
} | ||
} | ||
export default Vue.extend({ | ||
name: 'Unread', | ||
mixins: [ContextMenu], | ||
props: { | ||
user: { | ||
type: Object as PropType<User>, | ||
default: () => ({ | ||
name: '', | ||
address: '', | ||
profilePicture: '', | ||
unreadCount: 0, | ||
}), | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
contextMenuValues: [ | ||
{ text: this.$t('context.send'), func: this.testFunc }, | ||
{ text: this.$t('context.voice'), func: this.testFunc }, | ||
{ text: this.$t('context.video'), func: this.testFunc }, | ||
{ text: this.$t('context.profile'), func: this.testFunc }, | ||
{ text: this.$t('context.remove'), func: this.testFunc }, | ||
], | ||
} | ||
}, | ||
computed: { | ||
src(): string { | ||
const hash = this.user?.profilePicture | ||
return hash ? `${this.$Config.textile.browser}/ipfs/${hash}` : '' | ||
}, | ||
}, | ||
methods: { | ||
testFunc() { | ||
this.$Logger.log('User Context', 'Test func') | ||
}, | ||
navigateToUser() { | ||
if ( | ||
this.$route.params.address === this.user.address && | ||
this.$device.isMobile | ||
) { | ||
this.$store.commit('ui/showSidebar', false) | ||
} | ||
this.$router.push(`/chat/direct/${this.user.address}`) | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped lang="less" src="./Unread.less"></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
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
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