Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 feat: スタンプを押した人と数の表示を変更 #4320

Merged
merged 15 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
0c9afa4
💄 feat: ユーザーが押したスタンプ数が1のときにスタンプ数の表記をなくし、それに伴い区切り文字を追加
reiroop Jun 19, 2024
7571fb8
💄 feat: ユーザーの表示名を太字にする
reiroop Jun 19, 2024
670746a
💄 feat: ユーザーアイコンを表示名の前に追加し、boldを削除、全体を上下方向にセンタリング
reiroop Jun 20, 2024
e4e86e3
💄 feat: 表示をtraQ IDにしてみる
reiroop Jun 20, 2024
0e0f988
💄 feat: スタンプを押した人の表示をdisplayNameに変更
reiroop Jun 20, 2024
f3114d9
💄 feat: 表示名の間に薄い / を追加
reiroop Jun 20, 2024
49d6449
💄 feat: fromの後にスペースができるよう修正
reiroop Jun 20, 2024
c882e8c
💄 feat: 表示名の間のスペースを少し狭く
reiroop Jun 20, 2024
ebb9db6
🎨 feat: スタンプを押したユーザーの区切り文字の定義をStampDetailElementContentからStampDetailE…
reiroop Jun 20, 2024
72b2357
🎨 feat: スペースをpaddingを用いる形に変更
reiroop Jun 20, 2024
131f7ec
💄 feat: 名前と数の間に2pxのスペースを追加
reiroop Jun 24, 2024
55b5da2
🎨 fix: 不必要なdivを削除
reiroop Jun 24, 2024
35b8195
🎨 fix: cssのクラス名を以前のものと揃える
reiroop Jun 24, 2024
a61a1b8
🎨 fix: StampRecordPerUser 型を作成し、コードを置き換え
reiroop Jun 28, 2024
3101a06
🎨 fix: StampRecordPerUser を StampUser に変更
reiroop Jun 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions src/components/Main/MainView/MessageElement/StampDetailElement.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<template>
<div :class="$style.container">
<div>
{{ ':' + stampName + ': from' }}
{{ ':' + stampName + ': from ' }}
</div>
<div v-for="user in stamp.users" :key="user.id" :class="$style.contents">
<stamp-detail-element-content
:user-id="user.id"
:count="user.count"
:class="$style.content"
/>
<span v-if="!isLastUser(user)" :class="$style.delimiter"> / </span>
</div>
<stamp-detail-element-content
v-for="user in stamp.users"
:key="user.id"
:user-id="user.id"
:count="user.count"
:class="$style.content"
/>
</div>
</template>

<script lang="ts" setup>
import StampDetailElementContent from './StampDetailElementContent.vue'
import { computed } from 'vue'
import { useStampsStore } from '/@/store/entities/stamps'
import type { MessageStampById } from '/@/lib/messageStampList'
import type {
StampRecordPerUser,
MessageStampById
} from '/@/lib/messageStampList'

const props = defineProps<{
stamp: MessageStampById
Expand All @@ -28,17 +32,23 @@ const { stampsMap } = useStampsStore()
const stampName = computed(
() => stampsMap.value.get(props.stamp.id)?.name ?? ''
)

const isLastUser = (user: StampRecordPerUser) =>
user === props.stamp.users[props.stamp.users.length - 1]
</script>

<style lang="scss" module>
.container {
display: flex;
flex-wrap: wrap;
}
.contents {
display: flex;
}
.content {
&::before {
white-space: pre;
content: ' ';
}
padding: 0 0.2rem;
}
.delimiter {
@include color-ui-secondary-inactive;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div :class="$style.container" @click="openModal">
<div :class="$style.clickable" @click="openModal">
{{ user?.displayName ?? 'unknown' }}
<span :class="$style.numberWrap">
<span v-if="count > 1" :class="$style.numberWrap">
<spin-number :value="count" />
</span>
</div>
Expand All @@ -26,9 +26,10 @@ const { openModal } = useUserModalOpener(toRef(props, 'userId'))
</script>

<style lang="scss" module>
.container {
.clickable {
display: flex;
cursor: pointer;
gap: 2px;
}
.numberWrap {
display: flex;
Expand Down
11 changes: 10 additions & 1 deletion src/lib/messageStampList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import type { MessageStamp } from '@traptitech/traq'
import type { StampId, UserId } from '/@/types/entity-ids'

/**
* ユーザー、そのユーザーの押した数と最初に押した時間
*/
export interface StampRecordPerUser {
reiroop marked this conversation as resolved.
Show resolved Hide resolved
id: UserId
count: number
createdAt: Date
}

/**
* StampIdで整理されたMessageStamp
*/
Expand All @@ -20,7 +29,7 @@ export interface MessageStampById {
/**
* ユーザー、そのユーザーの押した数と最初に押した時間
*/
users: Array<{ id: UserId; count: number; createdAt: Date }>
users: Array<StampRecordPerUser>
/**
* 一番最初に押された時間
*/
Expand Down
Loading