Skip to content

Commit

Permalink
add rule of order of imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mehm8128 committed Sep 4, 2022
1 parent 521e37c commit 6a855a2
Show file tree
Hide file tree
Showing 17 changed files with 80 additions and 52 deletions.
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"vueIndentScriptAndStyle": false,
"endOfLine": "auto",
"importOrder": [
"^/@/store/(.*)$",
"^/@/stores/(.*)$",
"^/@/lib/(.*)$",
"^/@/(.*)",
"^[./]"
],
"importOrderSeparation": true
Expand Down
10 changes: 6 additions & 4 deletions src/components/HeaderButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ interface Props {
path: string
text: string
}
defineProps<Props>()
const props = defineProps<Props>()
</script>

<template>
<router-link :class="isHere ? 'cursor-default' : ''" :to="path">
<router-link :class="props.isHere ? 'cursor-default' : ''" :to="props.path">
<div
class="rounded-3xl p-2"
:class="isHere ? 'bg-zinc-200' : 'hover:bg-zinc-200'">
<span>{{ text }}</span>
:class="props.isHere ? 'bg-zinc-200' : 'hover:bg-zinc-200'">
<span>{{ props.text }}</span>
</div>
</router-link>
</template>
9 changes: 6 additions & 3 deletions src/components/groupDetail/GroupBudget.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script lang="ts" setup>
import type { EditMode } from './GroupDetail.vue'
import { useUserStore } from '/@/stores/user'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import FixButton from '/@/components/shared/FixButton.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import type { GroupDetailType } from '/@/pages/GroupDetailPage.vue'
import { useUserStore } from '/@/stores/user'
import type { EditMode } from './GroupDetail.vue'
interface Props {
group: GroupDetailType
Expand Down
9 changes: 6 additions & 3 deletions src/components/groupDetail/GroupDescription.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<script lang="ts" setup>
import type { EditMode } from './GroupDetail.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import { useUserStore } from '/@/stores/user'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import type { GroupDetailType } from '/@/pages/GroupDetailPage.vue'
import { useUserStore } from '/@/stores/user'
import type { EditMode } from './GroupDetail.vue'
interface Props {
group: GroupDetailType
Expand Down
13 changes: 8 additions & 5 deletions src/components/groupDetail/GroupDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import { ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/outline'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import GroupBudget from './GroupBudget.vue'
import GroupDescription from './GroupDescription.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import { useGroupStore } from '/@/stores/group'
import { useUserStore } from '/@/stores/user'
import apis from '/@/lib/apis'
import type { PostGroup } from '/@/lib/apis'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import type { GroupDetailType } from '/@/pages/GroupDetailPage.vue'
import { useGroupStore } from '/@/stores/group'
import { useUserStore } from '/@/stores/user'
import GroupBudget from './GroupBudget.vue'
import GroupDescription from './GroupDescription.vue'
export type EditMode = 'name' | 'description' | 'budget' | ''
Expand Down
8 changes: 5 additions & 3 deletions src/components/groupDetail/GroupMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import { MinusIcon, PlusIcon } from '@heroicons/vue/24/outline'
import { ref } from 'vue'
import UserIcon from '/@/components/shared/UserIcon.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import { useUserStore } from '/@/stores/user'
import apis from '/@/lib/apis'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import UserIcon from '/@/components/shared/UserIcon.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import type { GroupDetailType } from '/@/pages/GroupDetailPage.vue'
import { useUserStore } from '/@/stores/user'
interface Props {
group: GroupDetailType
Expand Down
8 changes: 5 additions & 3 deletions src/components/groupDetail/GroupOwners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import { MinusIcon, PlusIcon } from '@heroicons/vue/24/outline'
import { ref } from 'vue'
import UserIcon from '/@/components/shared/UserIcon.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import { useUserStore } from '/@/stores/user'
import apis from '/@/lib/apis'
import { isAdminOrGroupOwner } from '/@/lib/authorityCheck'
import UserIcon from '/@/components/shared/UserIcon.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import type { GroupDetailType } from '/@/pages/GroupDetailPage.vue'
import { useUserStore } from '/@/stores/user'
interface Props {
group: GroupDetailType
Expand Down
12 changes: 7 additions & 5 deletions src/components/shared/PageLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
interface Props {
path: string
page: number
selected: boolean
isSelected: boolean
}
defineProps<Props>()
const props = defineProps<Props>()
</script>

<template>
<router-link
class="block flex w-10 items-center justify-center rounded"
:class="selected ? 'cursor-default bg-blue-200' : 'hover:bg-gray-200'"
:to="`${path}?page=${page}`">
<span>{{ page }}</span>
:class="
props.isSelected ? 'cursor-default bg-blue-200' : 'hover:bg-gray-200'
"
:to="`${props.path}?page=${props.page}`">
<span>{{ props.page }}</span>
</router-link>
</template>
12 changes: 6 additions & 6 deletions src/components/shared/PaginationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const right = computed(
v-for="page in left"
:key="page"
class="not-last:mr-1"
:is-selected="page === currentPage"
:page="page"
:path="path"
:selected="page === currentPage" />
:path="path" />
</div>

<!-- Center -->
Expand All @@ -75,9 +75,9 @@ const right = computed(
v-for="page in center"
:key="page"
class="not-last:mr-1"
:is-selected="page === currentPage"
:page="page"
:path="path"
:selected="page === currentPage" />
:path="path" />
</div>

<!-- Right -->
Expand All @@ -91,9 +91,9 @@ const right = computed(
v-for="page in right"
:key="page"
class="not-last:mr-1"
:is-selected="page === currentPage"
:page="page"
:path="path"
:selected="page === currentPage" />
:path="path" />
</div>

<!-- Next -->
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/SimpleButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ const paddingClass = computed(() => {
<template>
<button
:class="`rounded-md border border-zinc-300 hover:bg-gray-200 ${fontSizeClass} ${paddingClass}`">
<slot></slot>
<slot />
</button>
</template>
4 changes: 2 additions & 2 deletions src/components/shared/UserIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
interface Props {
name: string
}
defineProps<Props>()
const props = defineProps<Props>()
</script>

<template>
<img
alt="icon"
class="rounded-1/2 h-full p-1"
:src="'https://q.trap.jp/api/v3/public/icon/' + name" />
:src="`https://q.trap.jp/api/v3/public/icon/${props.name}`" />
</template>
10 changes: 6 additions & 4 deletions src/pages/AdminPage.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import apis from '/@/lib/apis'
import { isAdmin } from '/@/lib/authorityCheck'
import { useAdminStore } from '/@/stores/admin'
import { useUserStore } from '/@/stores/user'
import apis from '/@/lib/apis'
import { isAdmin } from '/@/lib/authorityCheck'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
const adminStore = useAdminStore()
const userStore = useUserStore()
Expand Down
11 changes: 7 additions & 4 deletions src/pages/GroupDetailPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import axios from 'axios'
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useUserStore } from '/@/stores/user'
import apis from '/@/lib/apis'
import { toId } from '/@/lib/parsePathParams'
import GroupDetail from '/@/components/groupDetail/GroupDetail.vue'
import GroupMembers from '/@/components/groupDetail/GroupMembers.vue'
import GroupOwners from '/@/components/groupDetail/GroupOwners.vue'
import apis from '/@/lib/apis'
import { toId } from '/@/lib/parsePathParams'
import { useUserStore } from '/@/stores/user'
export interface GroupDetailType {
id: string
Expand Down Expand Up @@ -46,8 +48,9 @@ onMounted(async () => {
</script>

<template>
<div v-if="group === undefined">loadng...</div>
<div
v-if="group !== undefined"
v-else
class="min-w-80 mx-auto flex h-full w-4/5 flex-col justify-between px-12 pt-4 md:flex-row">
<group-detail class="md:w-3/4" :group="group" @fix-group="group = $event" />
<div class="flex flex-col gap-8 py-4 md:w-1/4">
Expand Down
8 changes: 5 additions & 3 deletions src/pages/GroupsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { ref, watch } from 'vue'
import type { LocationQueryValue } from 'vue-router'
import { useRoute } from 'vue-router'
import { useGroupStore } from '/@/stores/group'
import { useUserStore } from '/@/stores/user'
import { isAdmin } from '/@/lib/authorityCheck'
import GroupItem from '/@/components/GroupItem.vue'
import PaginationBar from '/@/components/shared/PaginationBar.vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import { isAdmin } from '/@/lib/authorityCheck'
import { useGroupStore } from '/@/stores/group'
import { useUserStore } from '/@/stores/user'
const toPage = (v: LocationQueryValue | LocationQueryValue[]) => {
if (Array.isArray(v)) {
Expand Down
10 changes: 6 additions & 4 deletions src/pages/NewGroupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import { storeToRefs } from 'pinia'
import { onMounted, ref } from 'vue'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
import type { Group, PostGroup } from '/@/lib/apis'
import apis from '/@/lib/apis'
import { useGroupStore } from '/@/stores/group'
import { useUserStore } from '/@/stores/user'
import type { Group, PostGroup } from '/@/lib/apis'
import apis from '/@/lib/apis'
import SimpleButton from '/@/components/shared/SimpleButton.vue'
import VueSelect from '/@/components/shared/VueSelect.vue'
const userStore = useUserStore()
const groupStore = useGroupStore()
Expand Down
1 change: 0 additions & 1 deletion src/types/vue-select.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions windi.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default defineConfig({
colors: {
primary: colors.dark[500],
secondary: colors.gray[400]
//todo:backgroun-color
}
}
}
Expand Down

0 comments on commit 6a855a2

Please sign in to comment.