From 49239c415a91ac36f2b3266fbf2cc6b8ea3ebaff Mon Sep 17 00:00:00 2001 From: mehm8128 Date: Wed, 12 Oct 2022 16:59:22 +0900 Subject: [PATCH 01/10] add userAccount page --- src/components/Layout/PageContainer.vue | 10 +-- src/components/UserAccounts/AccountItem.vue | 65 ++++++++++++++ src/components/UserAccounts/ServiceLogo.vue | 43 +++++++++ src/consts/services.ts | 47 ++++++++++ src/pages/UserAccounts.vue | 99 +++++++++++++++++++++ src/router/index.ts | 6 ++ 6 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 src/components/UserAccounts/AccountItem.vue create mode 100644 src/components/UserAccounts/ServiceLogo.vue create mode 100644 src/consts/services.ts create mode 100644 src/pages/UserAccounts.vue diff --git a/src/components/Layout/PageContainer.vue b/src/components/Layout/PageContainer.vue index aba80251..776b25f8 100644 --- a/src/components/Layout/PageContainer.vue +++ b/src/components/Layout/PageContainer.vue @@ -1,15 +1,9 @@ + + - - diff --git a/src/components/UserAccounts/ServiceLogo.vue b/src/components/UserAccounts/ServiceLogo.vue new file mode 100644 index 00000000..34569d69 --- /dev/null +++ b/src/components/UserAccounts/ServiceLogo.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/consts/services.ts b/src/consts/services.ts new file mode 100644 index 00000000..e37f9ffd --- /dev/null +++ b/src/consts/services.ts @@ -0,0 +1,47 @@ +export interface Service { + name: string + icon: string +} + +export const serviceArray: Service[] = [ + { + name: 'HomePage', + icon: 'mdi:home' + }, + { + name: 'Blog', + icon: 'mdi:post-outline' + }, + { + name: 'Twitter', + icon: 'mdi:twitter' + }, + { + name: 'Facebook', + icon: 'mdi:facebook' + }, + { + name: 'pixiv', + icon: 'simple-icons:pixiv' + }, + { + name: 'Github', + icon: 'mdi:github' + }, + { + name: 'Qiita', + icon: 'simple-icons:qiita' + }, + { + name: 'Zenn', + icon: 'simple-icons:zenn' + }, + { + name: 'AtCoder', + icon: 'atcoder' + }, + { + name: 'SoundCloud', + icon: 'mdi:soundcloud' + } +] diff --git a/src/pages/UserAccounts.vue b/src/pages/UserAccounts.vue new file mode 100644 index 00000000..b89eb7fa --- /dev/null +++ b/src/pages/UserAccounts.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 9323b8f3..5140f6fb 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router' const Index = () => import('/@/pages/Index.vue') const User = () => import('/@/pages/User.vue') +const UserAccounts = () => import('/@/pages/UserAccounts.vue') const Projects = () => import('/@/pages/Projects.vue') const Project = () => import('/@/pages/Project.vue') const Events = () => import('/@/pages/Events.vue') @@ -55,6 +56,11 @@ const routes = [ path: '/user', name: 'Profile', component: User + }, + { + path: '/user/accounts', + name: 'UserAccounts', + component: UserAccounts } ] From 50ed0c78f237bb7f7393342ba80df87ba6f9eae9 Mon Sep 17 00:00:00 2001 From: mehm8128 Date: Sat, 15 Oct 2022 20:59:49 +0900 Subject: [PATCH 02/10] remove mock --- src/pages/UserAccounts.vue | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/pages/UserAccounts.vue b/src/pages/UserAccounts.vue index b89eb7fa..6b110a68 100644 --- a/src/pages/UserAccounts.vue +++ b/src/pages/UserAccounts.vue @@ -3,32 +3,18 @@ import ContentHeader from '/@/components/Layout/ContentHeader.vue' import PageContainer from '/@/components/Layout/PageContainer.vue' import BaseButton from '/@/components/UI/BaseButton.vue' -import type { Account } from '/@/lib/apis' import AccountItem from '/@/components/UserAccounts/AccountItem.vue' +import { ref } from 'vue' +import apis from '/@/lib/apis' +import useUserDataFetcher from '/@/use/userDataFetcher' -const accounts: Account[] = [ - { - id: '3fa85f64-5717-4562-b3fc-2c963f66afa6', - displayName: 'mehm8128', - type: 5, - prPermitted: true, - url: 'https://github.com/mehm8128' - }, - { - id: '3fa85f64-5717-4562-b3fc-2c963f66afa7', - displayName: 'mehm8128', - type: 8, - prPermitted: false, - url: 'https://atcoder.jp/users/mehm8128' - }, - { - id: '3fa85f64-5717-4562-b3fc-2c963f66afa8', - displayName: 'mehm8128', - type: 1, - prPermitted: true, - url: 'https://trap.jp/author/mehm8128/' - } -] +const userId = ref('c714a848-2886-4c10-a313-de9bc61cb2bb') +// todo: get meが実装されたらそれを使う + +const { data: accounts, fetcherState: fetcherState } = useUserDataFetcher( + userId, + userId => apis.getUserAccounts(userId) +)