-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): improve events list (#759)
* feat(dashboard): improve events list * feat(dashboard): refactor events * fix: build * feat: time ago tooltip
- Loading branch information
1 parent
0f16b6b
commit 5eca37c
Showing
21 changed files
with
318 additions
and
191 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
35 changes: 22 additions & 13 deletions
35
frontend/dashboard/src/components/dashboard/events/ban.vue
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
75 changes: 61 additions & 14 deletions
75
frontend/dashboard/src/components/dashboard/events/base.vue
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 |
---|---|---|
@@ -1,35 +1,82 @@ | ||
<script lang="ts" setup> | ||
import type { SVGProps } from '@tabler/icons-vue'; | ||
import { UseTimeAgo } from '@vueuse/components'; | ||
import type { FunctionalComponent } from 'vue'; | ||
import { UseTimeAgo } from '@vueuse/components' | ||
import { computed } from 'vue' | ||
defineProps<{ | ||
import type { SVGProps } from '@tabler/icons-vue' | ||
import type { FunctionalComponent } from 'vue' | ||
import { useTheme } from '@/composables/use-theme.js' | ||
const props = defineProps<{ | ||
icon: FunctionalComponent<SVGProps, Record<string, any>, any> | ||
iconColor?: string; | ||
iconColor?: [light: string, dark: string] | ||
createdAt: string | ||
}>(); | ||
}>() | ||
defineSlots<{ | ||
leftContent: any, | ||
rightContent: any, | ||
}>(); | ||
leftContent: any | ||
rightContent: any | ||
}>() | ||
const locale = navigator.language | ||
const theme = useTheme() | ||
const color = computed(() => { | ||
if (!props.iconColor) return | ||
return props.iconColor.at(Number(theme.theme.value === 'dark')) | ||
}) | ||
const date = computed(() => new Date(Number(props.createdAt))) | ||
</script> | ||
|
||
<template> | ||
<div class="flex min-h-[50px] gap-2.5 px-1 select-text border-b-[color:var(--n-border-color)] border-b border-solid"> | ||
<div class="flex min-h-[50px] gap-2.5 px-2.5 select-text border-b-[color:var(--n-border-color)] border-b border-solid"> | ||
<div class="flex justify-between items-center w-full"> | ||
<div class="flex gap-2.5 items-center"> | ||
<component :is="icon" class="flex items-center h-9 w-9" :style="{ color: iconColor }" /> | ||
<component | ||
:is="icon" | ||
class="flex items-center min-h-9 min-w-9" | ||
:style="{ color }" | ||
/> | ||
<div class="flex flex-col"> | ||
<slot name="leftContent" /> | ||
</div> | ||
</div> | ||
|
||
<div class="flex items-end text-xs h-full px-2.5 flex-shrink-0"> | ||
<UseTimeAgo v-slot="{ timeAgo }" :time="new Date(Number(createdAt))" :update-interval="1000" show-second> | ||
{{ timeAgo }} | ||
<div class="flex items-end text-xs h-full py-2 flex-shrink-0"> | ||
<UseTimeAgo | ||
v-slot="{ timeAgo }" | ||
:time="date" | ||
:update-interval="1000" | ||
show-second | ||
> | ||
<span class="tooltip" :data-utc="date.toLocaleString(locale)"> | ||
{{ timeAgo }} | ||
</span> | ||
</UseTimeAgo> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.tooltip { | ||
position: relative; | ||
} | ||
.tooltip:after { | ||
content: attr(data-utc); | ||
position: absolute; | ||
top: 0px; | ||
right: 0; | ||
left: -100px; | ||
display: none; | ||
text-align: center; | ||
background-color: #000; | ||
border-radius: 4px; | ||
padding: 2px; | ||
white-space: nowrap; | ||
} | ||
.tooltip:hover:after { | ||
display: block; | ||
} | ||
</style> |
18 changes: 10 additions & 8 deletions
18
frontend/dashboard/src/components/dashboard/events/chatClear.vue
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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
<script lang="ts" setup> | ||
import { IconEraser } from '@tabler/icons-vue'; | ||
import { IconEraser } from '@tabler/icons-vue' | ||
import Base from './base.vue'; | ||
import Base from './base.vue' | ||
defineProps<{ | ||
createdAt: string, | ||
}>(); | ||
createdAt: string | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<Base :icon="IconEraser" :created-at="createdAt"> | ||
<Base | ||
:icon="IconEraser" | ||
:icon-color="['#ff4f4d', '#ffaaa8']" | ||
:created-at="createdAt" | ||
> | ||
<template #leftContent> | ||
<div class="flex flex-col"> | ||
<span>Chat Cleared</span> | ||
</div> | ||
Chat cleared | ||
</template> | ||
</Base> | ||
</template> |
22 changes: 13 additions & 9 deletions
22
frontend/dashboard/src/components/dashboard/events/donate.vue
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
26 changes: 14 additions & 12 deletions
26
frontend/dashboard/src/components/dashboard/events/firstUserMessage.vue
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
22 changes: 12 additions & 10 deletions
22
frontend/dashboard/src/components/dashboard/events/follow.vue
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 |
---|---|---|
@@ -1,22 +1,24 @@ | ||
<script lang="ts" setup> | ||
import { IconHeartFilled } from '@tabler/icons-vue'; | ||
import { IconHeartFilled } from '@tabler/icons-vue' | ||
import Base from './base.vue'; | ||
import { resolveUserName } from '@/helpers/index.js'; | ||
import Base from './base.vue' | ||
import UserLink from './user-link.vue' | ||
defineProps<{ | ||
userName: string, | ||
userDisplayName: string, | ||
userName: string | ||
userDisplayName: string | ||
createdAt: string | ||
}>(); | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<Base :icon="IconHeartFilled" :created-at="createdAt"> | ||
<Base | ||
:icon="IconHeartFilled" | ||
:icon-color="['#c516a5', '#ff38db']" | ||
:created-at="createdAt" | ||
> | ||
<template #leftContent> | ||
{{ resolveUserName(userName, userDisplayName) }} | ||
<UserLink :name="userName" :display-name="userDisplayName" /> | ||
</template> | ||
</Base> | ||
</template> |
Oops, something went wrong.