refactor: improve UI

zio/stable
三咲智子 2022-11-23 22:39:48 +08:00
parent 1771291c08
commit 889b4b8a00
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
12 changed files with 54 additions and 39 deletions

View File

@ -7,7 +7,7 @@ const { account } = defineProps<{
</script> </script>
<template> <template>
<div flex justify-between> <div flex justify-between hover:bg-active transition-100>
<AccountInfo :account="account" p1 /> <AccountInfo :account="account" p1 />
<div h-full p1> <div h-full p1>
<AccountFollowButton :account="account" /> <AccountFollowButton :account="account" />

View File

@ -17,7 +17,7 @@ async function toggleFollow() {
<template> <template>
<button <button
v-if="!isSelf && relationship" v-if="!isSelf && relationship"
flex gap-1 items-center w-full rounded hover="op100 text-white b-purple" group flex gap-1 items-center h-fit rounded hover="op100 text-white b-purple" group
@click="toggleFollow" @click="toggleFollow"
> >
<div rounded w-28 p2 :group-hover="relationship?.following ? 'bg-red/30' : 'bg-purple/30'" :class="!relationship?.following ? 'bg-cyan/10' : ' bg-purple/10'"> <div rounded w-28 p2 :group-hover="relationship?.following ? 'bg-red/30' : 'bg-purple/30'" :class="!relationship?.following ? 'bg-cyan/10' : ' bg-purple/10'">

View File

@ -24,14 +24,14 @@ const createdAt = $computed(() => {
<AccountAvatar :account="account" w-30 h-30 /> <AccountAvatar :account="account" w-30 h-30 />
</NuxtLink> </NuxtLink>
</div> </div>
<NuxtLink flex flex-col :to="`/@${account.acct}`"> <div flex flex-col>
<CommonRichContent font-bold text-2xl :content="getDisplayName(account)" :emojis="account.emojis" /> <CommonRichContent font-bold text-2xl :content="getDisplayName(account)" :emojis="account.emojis" />
<p op50> <p op50>
@{{ account.acct }} @{{ account.acct }}
</p> </p>
</NuxtLink>
</div> </div>
<div flex gap-2> </div>
<div flex gap-2 items-center>
<AccountFollowButton :account="account" /> <AccountFollowButton :account="account" />
<!-- <button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group> <!-- <button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group>
<div rounded p2 group-hover="bg-rose/10"> <div rounded p2 group-hover="bg-rose/10">
@ -65,13 +65,13 @@ const createdAt = $computed(() => {
</div> </div>
</div> </div>
<div flex gap-5> <div flex gap-5>
<NuxtLink :to="`/@${account.acct}/`"> <NuxtLink :to="`/@${account.acct}/`" active-class="text-primary">
<span font-bold>{{ account.statusesCount }}</span> Posts <span font-bold>{{ account.statusesCount }}</span> Posts
</NuxtLink> </NuxtLink>
<NuxtLink :to="`/@${account.acct}/following`"> <NuxtLink :to="`/@${account.acct}/following`" active-class="text-primary">
<span font-bold>{{ account.followingCount }}</span> Following <span font-bold>{{ account.followingCount }}</span> Following
</NuxtLink> </NuxtLink>
<NuxtLink :to="`/@${account.acct}/followers`"> <NuxtLink :to="`/@${account.acct}/followers`" active-class="text-primary">
<span font-bold>{{ account.followersCount }}</span> Followers <span font-bold>{{ account.followersCount }}</span> Followers
</NuxtLink> </NuxtLink>
</div> </div>

View File

@ -0,0 +1,13 @@
<script setup lang="ts">
import type { Account } from 'masto'
defineProps<{
account: Account
}>()
</script>
<template>
<NuxtLink :to="`/@${account.acct}`">
{{ getDisplayName(account) }}
</NuxtLink>
</template>

View File

@ -13,7 +13,7 @@ const { paginator } = defineProps<{
<template #default="{ item }"> <template #default="{ item }">
<AccountCard <AccountCard
:account="item" :account="item"
border="b base" py-1 border="b base" p1
/> />
</template> </template>
</CommonPaginator> </CommonPaginator>

View File

@ -27,7 +27,7 @@ function toValidName(otpion: string) {
flex flex-1 cursor-pointer p3 m1 rounded transition-all flex flex-1 cursor-pointer p3 m1 rounded transition-all
:for="`tab-${toValidName(option)}`" :for="`tab-${toValidName(option)}`"
tabindex="1" tabindex="1"
hover:bg-active hover:bg-active transition-100
@keypress.enter="modelValue = option" @keypress.enter="modelValue = option"
><span ><span
mxa px2 mxa px2

View File

@ -4,41 +4,41 @@
<template> <template>
<div px6 py2 flex="~ col gap6" text-lg> <div px6 py2 flex="~ col gap6" text-lg>
<template v-if="currentUser"> <template v-if="currentUser">
<NuxtLink flex gap2 items-center to="/home" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/home" active-class="text-primary">
<div i-ri:home-5-line /> <div i-ri:home-5-line />
<span>Home</span> <span>Home</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center to="/notifications" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/notifications" active-class="text-primary">
<div i-ri:notification-4-line /> <div i-ri:notification-4-line />
<span>Notifications</span> <span>Notifications</span>
</NuxtLink> </NuxtLink>
</template> </template>
<NuxtLink flex gap2 items-center to="/explore" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/explore" active-class="text-primary">
<div i-ri:hashtag /> <div i-ri:hashtag />
<span>Explore</span> <span>Explore</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center to="/public/local" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/public/local" active-class="text-primary">
<div i-ri:group-2-line /> <div i-ri:group-2-line />
<span>Local</span> <span>Local</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center to="/public" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/public" active-class="text-primary">
<div i-ri:earth-line /> <div i-ri:earth-line />
<span>Federated</span> <span>Federated</span>
</NuxtLink> </NuxtLink>
<template v-if="currentUser"> <template v-if="currentUser">
<NuxtLink flex gap2 items-center to="/conversations" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/conversations" active-class="text-primary">
<div i-ri:at-line /> <div i-ri:at-line />
<span>Conversations</span> <span>Conversations</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center to="/favourites" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/favourites" active-class="text-primary">
<div i-ri:heart-3-line /> <div i-ri:heart-3-line />
<span>Favorites</span> <span>Favorites</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center to="/bookmarks" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 to="/bookmarks" active-class="text-primary">
<div i-ri:bookmark-line /> <div i-ri:bookmark-line />
<span>Bookmarks</span> <span>Bookmarks</span>
</NuxtLink> </NuxtLink>
<NuxtLink flex gap2 items-center :to="`/@${currentUser.account?.username}`" active-class="text-primary"> <NuxtLink flex gap2 items-center transition-100 :to="`/@${currentUser.account?.username}`" active-class="text-primary">
<AccountAvatar :account="currentUser.account" h="1.2em" /> <AccountAvatar :account="currentUser.account" h="1.2em" />
<span>Profile</span> <span>Profile</span>
</NuxtLink> </NuxtLink>

View File

@ -4,34 +4,36 @@ import type { Notification } from 'masto'
const { notification } = defineProps<{ const { notification } = defineProps<{
notification: Notification notification: Notification
}>() }>()
const displayName = $computed(() => getDisplayName(notification.account))
</script> </script>
<template> <template>
<div flex flex-col> <div flex flex-col>
<template v-if="notification.type === 'follow'"> <template v-if="notification.type === 'follow'">
<div flex ml-4> <div flex ml-4 items-center>
<div i-ri:user-follow-fill mr-3 color-purple />{{ displayName }} followed you <div i-ri:user-follow-fill mr-3 color-purple />
<AccountLink :account="notification.account" mr1 /> followed you
</div> </div>
<AccountCard :account="notification.account" p3 /> <AccountCard :account="notification.account" p3 />
</template> </template>
<template v-if="notification.type === 'follow_request'"> <template v-if="notification.type === 'follow_request'">
<div flex ml-4> <div flex ml-4 items-center>
<div i-ri:user-follow-fill mr-3 />{{ displayName }} requested to follow you <div i-ri:user-follow-fill mr-3 />
<AccountLink :account="notification.account" mr1 /> requested to follow you
</div> </div>
<!-- TODO: accept request --> <!-- TODO: accept request -->
<AccountCard :account="notification.account" p3 /> <AccountCard :account="notification.account" p3 />
</template> </template>
<template v-if="notification.type === 'favourite'"> <template v-if="notification.type === 'favourite'">
<div flex ml-4> <div flex ml-4 items-center>
<div i-ri:heart-fill mr-3 color-red />{{ displayName }} favourited your post <div i-ri:heart-fill mr-3 color-red />
<AccountLink :account="notification.account" mr1 /> favourited your post
</div> </div>
<StatusCard :status="notification.status!" p3 /> <StatusCard :status="notification.status!" p3 />
</template> </template>
<template v-if="notification.type === 'reblog'"> <template v-if="notification.type === 'reblog'">
<div flex ml-4> <div flex ml-4 items-center>
<div i-ri:repeat-fill mr-3 color-green />{{ displayName }} reblogged your post <div i-ri:repeat-fill mr-3 color-green />
<AccountLink :account="notification.account" mr1 /> reblogged your post
</div> </div>
<StatusCard :status="notification.status!" p3 /> <StatusCard :status="notification.status!" p3 />
</template> </template>

View File

@ -36,15 +36,15 @@ const toggleBookmark = () => toggleStatusAction(
</script> </script>
<template> <template>
<div flex gap-8> <div flex justify-between gap-8>
<RouterLink flex gap-1 items-center w-full rounded op50 hover="op100 text-blue" group :to="`/@${status.account.acct}/${status.id}`"> <RouterLink flex gap-1 items-center rounded op50 hover="op100 text-blue" group :to="`/@${status.account.acct}/${status.id}`">
<div rounded-full p2 group-hover="bg-blue/10"> <div rounded-full p2 group-hover="bg-blue/10">
<div i-ri:chat-3-line /> <div i-ri:chat-3-line />
</div> </div>
<span v-if="status.repliesCount">{{ status.repliesCount }}</span> <span v-if="status.repliesCount">{{ status.repliesCount }}</span>
</RouterLink> </RouterLink>
<button <button
flex gap-1 items-center w-full rounded op50 hover="op100 text-green" group flex gap-1 items-center rounded op50 hover="op100 text-green" group
:class="(status.reblogged ? 'text-green op100' : 'op50') + (isLoading.reblogged ? ' pointer-events-none' : '')" :class="(status.reblogged ? 'text-green op100' : 'op50') + (isLoading.reblogged ? ' pointer-events-none' : '')"
@click="toggleReblog()" @click="toggleReblog()"
> >
@ -54,7 +54,7 @@ const toggleBookmark = () => toggleStatusAction(
<span v-if="status.reblogsCount">{{ status.reblogsCount }}</span> <span v-if="status.reblogsCount">{{ status.reblogsCount }}</span>
</button> </button>
<button <button
flex gap-1 items-center w-full rounded hover="op100 text-rose" group flex gap-1 items-center rounded hover="op100 text-rose" group
:class="status.favourited ? 'text-rose op100' : 'op50'" :class="status.favourited ? 'text-rose op100' : 'op50'"
@click="toggleFavourite()" @click="toggleFavourite()"
> >
@ -64,7 +64,7 @@ const toggleBookmark = () => toggleStatusAction(
<span v-if="status.favouritesCount">{{ status.favouritesCount }}</span> <span v-if="status.favouritesCount">{{ status.favouritesCount }}</span>
</button> </button>
<button <button
flex gap-1 items-center w-full rounded hover="op100 text-yellow" group flex gap-1 items-center rounded hover="op100 text-yellow" group
:class="status.bookmarked ? 'text-yellow op100' : 'op50'" :class="status.bookmarked ? 'text-yellow op100' : 'op50'"
@click="toggleBookmark()" @click="toggleBookmark()"
> >
@ -72,7 +72,7 @@ const toggleBookmark = () => toggleStatusAction(
<div :class="(status.bookmarked ? 'i-ri:bookmark-fill' : 'i-ri:bookmark-line') + (isLoading.bookmarked ? ' pointer-events-none' : '')" /> <div :class="(status.bookmarked ? 'i-ri:bookmark-fill' : 'i-ri:bookmark-line') + (isLoading.bookmarked ? ' pointer-events-none' : '')" />
</div> </div>
</button> </button>
<!-- <button flex gap-1 items-center w-full rounded op50 hover="op100 text-purple" group> <!-- <button flex gap-1 items-center rounded op50 hover="op100 text-purple" group>
<div rounded-full p2 group-hover="bg-purple/10"> <div rounded-full p2 group-hover="bg-purple/10">
<div i-ri:share-circle-line /> <div i-ri:share-circle-line />
</div> </div>

View File

@ -63,7 +63,7 @@ const timeago = useTimeAgo(() => status.createdAt, {
</script> </script>
<template> <template>
<div ref="el" flex flex-col gap-2 px-4 hover:bg="gray/10" transition="duration-100" cursor-pointer @click="go"> <div ref="el" flex flex-col gap-2 px-4 hover:bg-active transition-100 cursor-pointer @click="go">
<div v-if="rebloggedBy" pl8> <div v-if="rebloggedBy" pl8>
<div flex gap-1 items-center text-gray:75 text-sm> <div flex gap-1 items-center text-gray:75 text-sm>
<div i-ri:repeat-fill mr-1 /> <div i-ri:repeat-fill mr-1 />
@ -92,6 +92,6 @@ const timeago = useTimeAgo(() => status.createdAt, {
:actions="false" :actions="false"
/> />
</div> </div>
<StatusActions v-if="actions !== false" pl13 :status="status" /> <StatusActions v-if="actions !== false" px13 :status="status" />
</div> </div>
</template> </template>

View File

@ -21,7 +21,7 @@ const sorted = computed(() => {
:link="false" :link="false"
:full-server="true" :full-server="true"
rounded p2 rounded p2
hover:bg-active cursor-pointer hover:bg-active cursor-pointer transition-100
@click="loginTo(user)" @click="loginTo(user)"
> >
<template v-if="user.token === currentUser?.token"> <template v-if="user.token === currentUser?.token">

View File

@ -12,7 +12,7 @@
<AccountInfo <AccountInfo
v-if="currentUser" v-if="currentUser"
mx4 mb4 p2 rounded mx4 mb4 p2 rounded
hover:bg-active cursor-pointer hover:bg-active cursor-pointer transition-100
:account="currentUser?.account" :account="currentUser?.account"
:link="false" :link="false"
@click="openUserSwitcher" @click="openUserSwitcher"