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>
<template>
<div flex justify-between>
<div flex justify-between hover:bg-active transition-100>
<AccountInfo :account="account" p1 />
<div h-full p1>
<AccountFollowButton :account="account" />

View File

@ -17,7 +17,7 @@ async function toggleFollow() {
<template>
<button
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"
>
<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 />
</NuxtLink>
</div>
<NuxtLink flex flex-col :to="`/@${account.acct}`">
<div flex flex-col>
<CommonRichContent font-bold text-2xl :content="getDisplayName(account)" :emojis="account.emojis" />
<p op50>
@{{ account.acct }}
</p>
</NuxtLink>
</div>
</div>
<div flex gap-2>
<div flex gap-2 items-center>
<AccountFollowButton :account="account" />
<!-- <button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group>
<div rounded p2 group-hover="bg-rose/10">
@ -65,13 +65,13 @@ const createdAt = $computed(() => {
</div>
</div>
<div flex gap-5>
<NuxtLink :to="`/@${account.acct}/`">
<NuxtLink :to="`/@${account.acct}/`" active-class="text-primary">
<span font-bold>{{ account.statusesCount }}</span> Posts
</NuxtLink>
<NuxtLink :to="`/@${account.acct}/following`">
<NuxtLink :to="`/@${account.acct}/following`" active-class="text-primary">
<span font-bold>{{ account.followingCount }}</span> Following
</NuxtLink>
<NuxtLink :to="`/@${account.acct}/followers`">
<NuxtLink :to="`/@${account.acct}/followers`" active-class="text-primary">
<span font-bold>{{ account.followersCount }}</span> Followers
</NuxtLink>
</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 }">
<AccountCard
:account="item"
border="b base" py-1
border="b base" p1
/>
</template>
</CommonPaginator>

View File

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

View File

@ -4,41 +4,41 @@
<template>
<div px6 py2 flex="~ col gap6" text-lg>
<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 />
<span>Home</span>
</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 />
<span>Notifications</span>
</NuxtLink>
</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 />
<span>Explore</span>
</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 />
<span>Local</span>
</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 />
<span>Federated</span>
</NuxtLink>
<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 />
<span>Conversations</span>
</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 />
<span>Favorites</span>
</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 />
<span>Bookmarks</span>
</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" />
<span>Profile</span>
</NuxtLink>

View File

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

View File

@ -36,15 +36,15 @@ const toggleBookmark = () => toggleStatusAction(
</script>
<template>
<div flex gap-8>
<RouterLink flex gap-1 items-center w-full rounded op50 hover="op100 text-blue" group :to="`/@${status.account.acct}/${status.id}`">
<div flex justify-between gap-8>
<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 i-ri:chat-3-line />
</div>
<span v-if="status.repliesCount">{{ status.repliesCount }}</span>
</RouterLink>
<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' : '')"
@click="toggleReblog()"
>
@ -54,7 +54,7 @@ const toggleBookmark = () => toggleStatusAction(
<span v-if="status.reblogsCount">{{ status.reblogsCount }}</span>
</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'"
@click="toggleFavourite()"
>
@ -64,7 +64,7 @@ const toggleBookmark = () => toggleStatusAction(
<span v-if="status.favouritesCount">{{ status.favouritesCount }}</span>
</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'"
@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>
</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 i-ri:share-circle-line />
</div>

View File

@ -63,7 +63,7 @@ const timeago = useTimeAgo(() => status.createdAt, {
</script>
<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 flex gap-1 items-center text-gray:75 text-sm>
<div i-ri:repeat-fill mr-1 />
@ -92,6 +92,6 @@ const timeago = useTimeAgo(() => status.createdAt, {
:actions="false"
/>
</div>
<StatusActions v-if="actions !== false" pl13 :status="status" />
<StatusActions v-if="actions !== false" px13 :status="status" />
</div>
</template>

View File

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

View File

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