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

💡 refactor: margin ではなく gap を使うようにする #358

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/components/groupDetail/GroupBudget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const { group } = storeToRefs(groupDetailStore)
</script>

<template>
<div v-if="group" class="flex flex-col">
<label class="text-xl">予算</label>
<p class="mt-3">{{ group?.budget }} 円</p>
<div v-if="group" class="flex flex-col gap-3">
<h2 class="text-xl">予算</h2>
<p>{{ group?.budget }} 円</p>
</div>
</template>
6 changes: 3 additions & 3 deletions src/components/groupDetail/GroupDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const { group } = storeToRefs(groupDetailStore)
</script>

<template>
<div v-if="group">
<p class="text-xl">詳細</p>
<div class="flex w-full mt-3">
<div v-if="group" class="flex flex-col gap-3">
<h2 class="text-xl">詳細</h2>
<div class="flex w-full">
<p class="min-h-32 w-full rounded border border-surface-secondary p-2">
{{ group.description }}
</p>
Expand Down
6 changes: 3 additions & 3 deletions src/components/groupDetail/GroupMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const { absentMemberOptions, isSending, addMembers, removeMember } =
</script>

<template>
<div v-if="group" class="relative flex flex-col justify-between">
<p class="text-xl">グループメンバー</p>
<div class="mt-3 border border-surface-secondary">
<div v-if="group" class="relative flex flex-col gap-3 justify-between">
<h2 class="text-xl">グループメンバー</h2>
<div class="border border-surface-secondary">
<ul class="flex flex-col gap-2 px-4 py-3 overflow-y-auto max-h-[50dvh]">
<li
v-for="member in group.members"
Expand Down
2 changes: 1 addition & 1 deletion src/components/groupDetail/GroupName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useGroupDetailStore } from '/@/stores/groupDetail'
import { useUserStore } from '/@/stores/user'

import type { EditMode } from '/@/components/groupDetail/composables/useGroupInformation'
import InputText from '/@/components/shared/InputText.vue'
import EditButton from '/@/components/shared/EditButton.vue'
import InputText from '/@/components/shared/InputText.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'

interface Props {
Expand Down
6 changes: 3 additions & 3 deletions src/components/groupDetail/GroupOwners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const { absentOwnerOptions, isSending, addOwners, removeOwner } =
</script>

<template>
<div v-if="group" class="relative flex flex-col justify-between">
<p class="text-xl">グループオーナー</p>
<div class="mt-3 border border-surface-secondary">
<div v-if="group" class="relative flex flex-col gap-3 justify-between">
<h2 class="text-xl">グループオーナー</h2>
<div class="border border-surface-secondary">
<ul class="flex flex-col gap-2 px-4 py-3 overflow-y-auto max-h-[50dvh]">
<li
v-for="owner in group.owners"
Expand Down
4 changes: 1 addition & 3 deletions src/components/modal/ModalWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script setup lang="ts">
const emit = defineEmits<{
(e: 'closeModal'): void
}>()
const emit = defineEmits<(e: 'closeModal') => void>()
</script>

<template>
Expand Down
6 changes: 2 additions & 4 deletions src/components/modal/StatusChangeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import { useToast } from 'vue-toastification'
import MarkdownTextarea from '/@/components/shared/MarkdownTextarea.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import StatusChip from '/@/components/shared/StatusChip.vue'
import type { RequestDetail } from '/@/features/request/model'
import { changeStatusUsecase } from '/@/features/request/usecase'
import type { RequestStatus } from '/@/features/requestStatus/model'
import type { RequestDetail } from '/@/features/request/model'

const props = defineProps<{
request: RequestDetail
nextStatus: RequestStatus
}>()
const emit = defineEmits<{
(e: 'closeModal'): void
}>()
const emit = defineEmits<(e: 'closeModal') => void>()

const toast = useToast()

Expand Down
6 changes: 3 additions & 3 deletions src/components/newRequest/NewRequestFileForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ interface Props {
}

const props = defineProps<Props>()
const emit = defineEmits<{ (e: 'input', value: FileSeed[]): void }>()
const emit = defineEmits<(e: 'input', value: FileSeed[]) => void>()

const inputRef = ref()

function handleFileChange(e: Event) {
if (!(e.target instanceof HTMLInputElement) || !e.target.files) {
return
}
Array.from(e.target.files).forEach(file => {
for (const file of Array.from(e.target.files)) {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => {
Expand All @@ -29,7 +29,7 @@ function handleFileChange(e: Event) {
{ name: file.name, src: reader.result as string, type: file.type }
])
}
})
}
if (inputRef.value) {
inputRef.value.value = null
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/newRequest/NewRequestTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
tags: Tag[]
}
const props = defineProps<Props>()
const emit = defineEmits<{ (e: 'input', value: Tag[]): void }>()
const emit = defineEmits<(e: 'input', value: Tag[]) => void>()
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/newRequest/NewRequestTargets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Props {
}

const props = defineProps<Props>()
const emit = defineEmits<{ (e: 'input', value: RequestTarget[]): void }>()
const emit = defineEmits<(e: 'input', value: RequestTarget[]) => void>()

const userStore = useUserStore()
const { userOptions } = storeToRefs(userStore)
Expand Down
6 changes: 3 additions & 3 deletions src/components/newTransaction/NewTransactionTarget.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts" setup>
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import InputText from '/@/components/shared/InputText.vue'
import { PlusIcon, TrashIcon } from '@heroicons/vue/24/outline'
import InputText from '/@/components/shared/InputText.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'

interface Props {
targets: string[]
}

const props = defineProps<Props>()
const emit = defineEmits<{ (e: 'input', value: string[]): void }>()
const emit = defineEmits<(e: 'input', value: string[]) => void>()

function handleEditTarget(index: number, value: string) {
emit(
Expand Down
2 changes: 1 addition & 1 deletion src/components/requestDetail/RequestGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const handleUpdateGroup = async () => {
<template>
<div class="flex flex-col gap-1">
<div class="flex items-center justify-between">
<div class="text-sm font-bold">グループ</div>
<h2 class="text-sm font-bold">グループ</h2>
<EditButton
v-if="hasAuthority"
:is-edit-mode="isEditMode"
Expand Down
12 changes: 6 additions & 6 deletions src/components/requestDetail/RequestTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { ref } from 'vue'

import { useUserStore } from '/@/stores/user'

import { useToast } from 'vue-toastification'
import EditButton from '/@/components/shared/EditButton.vue'
import TagsGroup from '/@/components/shared/TagsGroup.vue'
import InputSelectTagWithCreation from '/@/components/shared/InputSelectTagWithCreation.vue'
import type { Tag } from '/@/features/tag/model'
import { editRequestUsecase } from '/@/features/request/usecase'
import type { RequestDetail } from '/@/features/request/model'
import TagsGroup from '/@/components/shared/TagsGroup.vue'
import { useRequest } from '/@/features/request/composables'
import { useToast } from 'vue-toastification'
import type { RequestDetail } from '/@/features/request/model'
import { editRequestUsecase } from '/@/features/request/usecase'
import type { Tag } from '/@/features/tag/model'

const props = defineProps<{
request: RequestDetail
Expand Down Expand Up @@ -50,7 +50,7 @@ const handleUpdateTags = async () => {
<template>
<div class="flex flex-col gap-1">
<div class="flex items-center justify-between">
<div class="text-sm font-bold">タグ</div>
<h2 class="text-sm font-bold">タグ</h2>
<EditButton
v-if="hasAuthority"
:is-edit-mode="isEditMode"
Expand Down
12 changes: 6 additions & 6 deletions src/components/requestDetail/RequestTargets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { storeToRefs } from 'pinia'

import { useUserStore } from '/@/stores/user'

import EditButton from '/@/components/shared/EditButton.vue'
import { ref } from 'vue'
import { useToast } from 'vue-toastification'
import RequestTarget from '/@/components/requestDetail/RequestTarget.vue'
import type { RequestTargetDetail } from '/@/features/requestTarget/model'
import EditButton from '/@/components/shared/EditButton.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import { editRequestUsecase } from '/@/features/request/usecase'
import type { RequestDetail } from '/@/features/request/model'
import { useRequest } from '/@/features/request/composables'
import { useToast } from 'vue-toastification'
import type { RequestDetail } from '/@/features/request/model'
import { editRequestUsecase } from '/@/features/request/usecase'
import type { RequestTargetDetail } from '/@/features/requestTarget/model'

const props = defineProps<{
request: RequestDetail
Expand Down Expand Up @@ -53,7 +53,7 @@ const handleUpdateTargets = async () => {
<template>
<div class="flex flex-col gap-2">
<div class="flex items-center justify-between">
<div class="text-sm font-bold">払い戻し対象者</div>
<h2 class="text-sm font-bold">払い戻し対象者</h2>
<div class="flex items-center gap-2">
<SimpleButton
v-if="isEditMode"
Expand Down
6 changes: 2 additions & 4 deletions src/components/requests/RequestItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ const totalAmount = computed(
<div class="mx-2 flex items-center justify-center">
<StatusChip :status="request.status" />
</div>
<div class="flex-grow">
<div class="flex-grow flex flex-col gap-2">
<span class="text-xl">{{ request.title }}</span>
<div class="mt-2">
<TagsGroup :tags="request.tags" />
</div>
<TagsGroup :tags="request.tags" />
</div>
<div>
<div class="flex gap-4">
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/InputRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const props = defineProps<Props>()
</script>

<template>
<div class="space-x-4">
<div class="flex gap-4">
<label
v-for="option in props.options"
:key="option.key"
Expand Down
5 changes: 2 additions & 3 deletions src/components/shared/InputSelectMultiple.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts" setup>
import { ChevronDownIcon } from '@heroicons/vue/24/solid';
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';

import { ChevronDownIcon } from '@heroicons/vue/24/solid'
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type ValueValue = Record<string, any> | string | null
Expand Down
7 changes: 3 additions & 4 deletions src/components/shared/InputSelectSingle.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts" setup>
import { ChevronDownIcon } from '@heroicons/vue/24/solid';
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { ChevronDownIcon } from '@heroicons/vue/24/solid'
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type ValueValue = Record<string, any> | string | null
type ValueValue = Record<string, unknown> | string | null

interface Value {
key: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/transactionDetail/EditTransactionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const formattedDate = computed(() => formatDate(props.transaction.createdAt))
</script>

<template>
<form class="mb-4 space-y-2">
<form class="flex flex-col gap-2">
<div class="flex flex-col">
<label>紐づける申請</label>
<div class="flex gap-4">
Expand Down
24 changes: 11 additions & 13 deletions src/components/transactionDetail/TransactionDetail.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import { ArrowLongRightIcon } from '@heroicons/vue/24/outline'
import { computed } from 'vue'

import { formatDate } from '/@/lib/date'

import { ArrowLongRightIcon } from '@heroicons/vue/24/outline'
import TagsGroup from '/@/components/shared/TagsGroup.vue'
import type { Transaction } from '/@/features/transaction/model'

Expand All @@ -16,13 +16,13 @@ const formattedDate = computed(() => formatDate(props.transaction.createdAt))
</script>

<template>
<div class="mb-4 space-y-2">
<div>
<p class="font-bold">年月日</p>
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-3">
<h2 class="text-xl">年月日</h2>
<p>{{ formattedDate }}</p>
</div>
<div>
<p class="font-bold">入出金</p>
<div class="flex flex-col gap-3">
<h2 class="text-xl">入出金</h2>
<div>
<p>{{ Math.abs(transaction.amount) }}円</p>
<div
Expand All @@ -35,15 +35,13 @@ const formattedDate = computed(() => formatDate(props.transaction.createdAt))
</div>
</div>
</div>
<div>
<p class="font-bold">取引グループ</p>
<div class="flex flex-col gap-3">
<h2 class="text-xl">取引グループ</h2>
<p>{{ transaction.group ? transaction.group.name : 'なし' }}</p>
</div>
<div>
<p class="font-bold">タグ</p>
<div>
<TagsGroup :tags="transaction.tags" />
</div>
<div class="flex flex-col gap-3">
<h2 class="text-xl">タグ</h2>
<TagsGroup :tags="transaction.tags" />
</div>
</div>
</template>
6 changes: 4 additions & 2 deletions src/features/request/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { DateTime } from 'luxon'
import type { Group } from '/@/features/group/model'
import type { RequestComment } from '/@/features/requestComment/model'
import type {
RequestStatusDetail,
RequestStatus
RequestStatus,
RequestStatusDetail
} from '/@/features/requestStatus/model'
import type {
RequestTarget,
Expand All @@ -30,6 +30,8 @@ export interface RequestQuerySeed {
target: string
since: string
until: string
limit: number
offset: number
tags: string[]
group: string
}
Expand Down
6 changes: 4 additions & 2 deletions src/features/request/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { convertRequestCommentFromData } from '/@/features/requestComment/conver
import type { RequestComment } from '/@/features/requestComment/model'
import { convertRequestStatusFromData } from '/@/features/requestStatus/converter'
import type {
RequestStatusDetail,
RequestStatus
RequestStatus,
RequestStatusDetail
} from '/@/features/requestStatus/model'

import type {
Expand All @@ -31,6 +31,8 @@ const createRequestRepository = () => ({
querySeed.target,
querySeed.since,
querySeed.until,
querySeed.limit,
querySeed.offset,
querySeed.tags.join(','),
querySeed.group
)
Expand Down
Loading
Loading