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

users->user #187

Merged
merged 3 commits into from
Feb 12, 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
18 changes: 17 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,23 @@ jobs:
with:
name: apis
path: ./src/lib/apis/generated
- run: npm run lint
- run: npm run lint:nofix
format:
name: Format
runs-on: ubuntu-latest
needs: [packages, genApi]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: SKIP_GENAPI=1 npm ci
- uses: actions/download-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated
- run: npm run format:nofix
typeCheck:
name: Type Check
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dist

scripts/traPortfolio.v1.yaml
src/lib/apis/generated

.eslintcache
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"dev": "concurrently \"vite\" \"npm run start-mock\"",
"serve": "vite preview",
"build": "vite build",
"lint": "eslint --fix --ext .ts,.vue src",
"lint:nofix": "eslint --ext .ts,.vue src",
"lint": "eslint --fix --cache --ext .ts,.vue src",
"lint:nofix": "eslint --cache --ext .ts,.vue src",
"format": "prettier --cache --write \"src/**/*.{vue,ts}\"",
"format:nofix": "prettier --cache --check \"src/**/*.{vue,ts}\"",
"type-check": "vue-tsc --noEmit",
"test": "vitest --passWithNoTests",
"gen-api": "node scripts/generateApi.js",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Layout/PageHeader.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import SearchInput from '/@/components/UI/SearchInput.vue'
import Icon from '/@/components/UI/Icon.vue'
import { storeToRefs } from 'pinia';
import { useResponsiveStore } from '/@/store/responsive';
import { storeToRefs } from 'pinia'
import { useResponsiveStore } from '/@/store/responsive'

interface Props {
isOpenNavigationBar: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { RouterLink } from 'vue-router'
import BaseButton from '/@/components/UI/BaseButton.vue'
import UserIcon from '/@/components/UI/UserIcon.vue'
import UserAccounts from '/@/components/Users/UserAccounts.vue'
import UserAccounts from '/@/components/User/UserAccounts.vue'
import type { UserDetail } from '/@/lib/apis'

interface Props {
Expand All @@ -22,7 +22,7 @@ defineProps<Props>()
</div>
<div :class="$style.accounts">
<user-accounts :accounts="user.accounts" />
<router-link to="/users/accounts" :class="$style.link">
<router-link to="/user/accounts" :class="$style.link">
<base-button icon="mdi:account">Edit</base-button>
</router-link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { RouterLink } from 'vue-router'
import BaseButton from '/@/components/UI/BaseButton.vue'
import UserIcon from '/@/components/UI/UserIcon.vue'
import UserAccounts from '/@/components/Users/UserAccounts.vue'
import UserAccounts from '/@/components/User/UserAccounts.vue'
import type { UserDetail } from '/@/lib/apis'

interface Props {
Expand All @@ -23,7 +23,7 @@ defineProps<Props>()
</div>
<div :class="$style.accounts">
<user-accounts :accounts="user.accounts" />
<router-link to="/users/accounts" :class="$style.link">
<router-link to="/user/accounts" :class="$style.link">
<base-button icon="mdi:account">Edit</base-button>
</router-link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserAccounts/AccountItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defineProps<Props>()
</script>

<template>
<router-link :to="`/users/accounts/${account.id}/edit`" :class="$style.link">
<router-link :to="`/user/accounts/${account.id}/edit`" :class="$style.link">
<div :class="$style.container">
<div :class="$style.displayNameContainer">
<p :class="$style.displayName">{{ account.displayName }}</p>
Expand Down
4 changes: 1 addition & 3 deletions src/consts/eventLevel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export const eventLevels = deepFreeze({
}
}) satisfies EventLevelMap

export const getEventLevelFromValue = (
value: EventLevelValue
): EventLevel => {
export const getEventLevelFromValue = (value: EventLevelValue): EventLevel => {
return eventLevels[value].value
}
2 changes: 1 addition & 1 deletion src/lib/routeInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const routes: routeinfo[] = [
},
{
name: 'Profile',
path: '/users',
path: '/user',
icon: 'mdi:account-circle-outline',
description: '掲載するアカウントや自己紹介を編集します'
},
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Users.vue → src/pages/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { ref } from 'vue'
import ContentHeader from '/@/components/Layout/ContentHeader.vue'
import PageContainer from '/@/components/Layout/PageContainer.vue'
import UserProfileEdit from '/@/components/Users/UserProfileEdit.vue'
import UserProfileEdit from '/@/components/User/UserProfileEdit.vue'
import apis, { UserDetail } from '/@/lib/apis'
import UserProfileMobile from '/@/components/Users/UserProfileMobile.vue'
import UserProfileDesktop from '/@/components/Users/UserProfileDesktop.vue'
import UserProfileMobile from '/@/components/User/UserProfileMobile.vue'
import UserProfileDesktop from '/@/components/User/UserProfileDesktop.vue'
import { useResponsiveStore } from '/@/store/responsive'
import { storeToRefs } from 'pinia'

Expand All @@ -22,7 +22,7 @@ const user: UserDetail = (await apis.getUser(userId.value)).data
<div :class="$style.headerContainer">
<content-header
icon-name="mdi:account-circle-outline"
:header-texts="[{ title: 'Profile', url: '/users' }]"
:header-texts="[{ title: 'Profile', url: '/user' }]"
detail="プロフィールを変更します。"
:class="$style.header"
/>
Expand Down
12 changes: 6 additions & 6 deletions src/pages/UserAccountEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const updateAccount = async () => {
try {
await apis.editUserAccount(userId.value, accountId.value, formValues.value)
toast.success('アカウント情報を更新しました')
router.push('/users/accounts')
router.push('/user/accounts')
} catch {
toast.error('アカウント情報の更新に失敗しました')
}
Expand All @@ -60,7 +60,7 @@ const deleteAccount = async () => {
try {
await apis.deleteUserAccount(userId.value, accountId.value)
toast.success('アカウント情報を削除しました')
router.push('/users/accounts')
router.push('/user/accounts')
} catch {
toast.error('アカウント情報の削除に失敗しました')
}
Expand All @@ -74,11 +74,11 @@ const deleteAccount = async () => {
<content-header
icon-name="mdi:account-circle-outline"
:header-texts="[
{ title: 'Profile', url: '/users' },
{ title: 'Accounts', url: `/users/accounts` },
{ title: 'Profile', url: '/user' },
{ title: 'Accounts', url: `/user/accounts` },
{
title: 'Edit',
url: `/users/accounts/edit`
url: `/user/accounts/edit`
}
]"
detail="アカウント情報を編集します。"
Expand Down Expand Up @@ -122,7 +122,7 @@ const deleteAccount = async () => {
<delete-form target="アカウント" @delete="open" />

<div :class="$style.buttonContainer">
<router-link to="/users/accounts" :class="$style.link">
<router-link to="/user/accounts" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
10 changes: 5 additions & 5 deletions src/pages/UserAccountNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const createNewAccount = async () => {
try {
await apis.addUserAccount(userId.value, formValues)
toast.success('アカウント情報を登録しました')
router.push('/users/accounts')
router.push('/user/accounts')
} catch {
toast.error('アカウント情報の登録に失敗しました')
}
Expand All @@ -58,11 +58,11 @@ const createNewAccount = async () => {
<content-header
icon-name="mdi:account-circle-outline"
:header-texts="[
{ title: 'Profile', url: '/users' },
{ title: 'Accounts', url: `/users/accounts` },
{ title: 'Profile', url: '/user' },
{ title: 'Accounts', url: `/user/accounts` },
{
title: 'New',
url: `/users/accounts/new`
url: `/user/accounts/new`
}
]"
detail="アカウントを登録します。"
Expand Down Expand Up @@ -104,7 +104,7 @@ const createNewAccount = async () => {
</labeled-form>
</form>
<div :class="$style.buttonContainer">
<router-link to="/users/accounts" :class="$style.link">
<router-link to="/user/accounts" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
8 changes: 4 additions & 4 deletions src/pages/UserAccounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const accounts: Account[] = (await apis.getUserAccounts(userId.value)).data
<content-header
icon-name="mdi:account-circle-outline"
:header-texts="[
{ title: 'Profile', url: '/users' },
{ title: 'Accounts', url: '/users/accounts' }
{ title: 'Profile', url: '/user' },
{ title: 'Accounts', url: '/user/accounts' }
]"
detail="アカウント情報を変更します。"
:class="$style.header"
/>
<router-link to="/users/accounts/new" :class="$style.link">
<router-link to="/user/accounts/new" :class="$style.link">
<base-button type="primary" icon="mdi:account">New</base-button>
</router-link>
</div>
Expand All @@ -36,7 +36,7 @@ const accounts: Account[] = (await apis.getUserAccounts(userId.value)).data
</li>
</ul>

<router-link to="/users" :class="$style.link">
<router-link to="/user" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
12 changes: 6 additions & 6 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'

const Index = () => import('/@/pages/Index.vue')
const Users = () => import('/@/pages/Users.vue')
const User = () => import('/@/pages/User.vue')
const UserAccounts = () => import('/@/pages/UserAccounts.vue')
const UserAccountNew = () => import('/@/pages/UserAccountNew.vue')
const UserAccountEdit = () => import('/@/pages/UserAccountEdit.vue')
Expand Down Expand Up @@ -79,22 +79,22 @@ const routes = [
component: ContestTeamEdit
},
{
path: '/users',
path: '/user',
name: 'Profile',
component: Users
component: User
},
{
path: '/users/accounts',
path: '/user/accounts',
name: 'UserAccounts',
component: UserAccounts
},
{
path: '/users/accounts/new',
path: '/user/accounts/new',
name: 'UserAccountsNew',
component: UserAccountNew
},
{
path: '/users/accounts/:accountId/edit',
path: '/user/accounts/:accountId/edit',
name: 'UserAccountsEdit',
component: UserAccountEdit
}
Expand Down