-
Notifications
You must be signed in to change notification settings - Fork 0
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
Contestの詳細ページの作成 #51
Contestの詳細ページの作成 #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
色々書きました 🙏
レビュー放置してごめん !
src/pages/Contest.vue
Outdated
<section :class="$style.section"> | ||
<h2 :class="$style.h2">リンク</h2> | ||
<p :class="$style.content"> | ||
<a :href="contest.link">{{ contest.link }}</a> | ||
</p> | ||
</section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/pages/Contest.vue
Outdated
import { RouterLink } from 'vue-router' | ||
import { getDisplayDuration } from '/@/lib/date' | ||
import useParam from '/@/use/param' | ||
import useFetcher from '/@/use/fetcher' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exportしてる関数名と違って分かりづらいので、useDataFecher
のほうがいいかも
src/pages/Contest.vue
Outdated
import ContestTeamsComponent from '/@/components/Contest/ContestTeams.vue' | ||
|
||
const contestId = useParam('id') | ||
const { data: contest } = useFetcher<ContestDetail>(contestId, () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こんな感じに書いてもいいかも? fetcherState 使ってなさそうなので
const contest = ref<ContestDetail>()
watchEffect(async () => {
contest.value = (await apis.getContest(contestId.value)).data
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetcherStateを使うことにしました
@@ -1,39 +1,25 @@ | |||
import { ref, Ref } from 'vue' | |||
import { AxiosResponse } from 'axios' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetcher.tsは traPortfolio-UIから移植するときにコピーされたもので、Vuexの状態変化にしか使ってなさそうなので、元々のfetcher.ts
なくてもいいかも。
userDataFetcher.ts
とほとんど同じだから、userDataFetcher.ts
の役割をこいつに寄せて大丈夫な感じがする。
Dashboard では、こいつを fetcher という名前で 運用しても悪くない感じがした。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
たのんだー
.header { | ||
margin: 4rem 0 2rem; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使ってなさそう
src/pages/Contest.vue
Outdated
} | ||
.h2 { | ||
font-weight: bold; | ||
font-size: 20px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
font-size : 1.25rem;
がいいなー
src/pages/Contest.vue
Outdated
<contest-teams-component | ||
v-if="contestTeams !== undefined" | ||
:class="$style.content" | ||
:contest-id="contestId" | ||
:contest-teams="contestTeams" | ||
@input="searchContestTeams($event)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
絞り込んだあとのチームを表示する責任があるのは、ContestTeams.vue
だから、ContestTeams.vue
に、絞り込む機能を実装したほうがもっとスッキリかけそう。
Contest.vue
では、全チームをpropsを通して ContestTeams.vue
に流し込むだけで、 ContestTeams.vue
では、searchQuery
を利用していい感じに絞り込むとかかな 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
サーバーで検索機能実装してもらえたら@input
時にContest.vue
でsearchQuery
を使ってContestTeams
をfetchしたいので、それを踏まえてContest.vue
に書きました
検索機能をどっちで実装するかportfolioのチャンネルで相談してみます
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そしたら、ContestTeam
が検索するたびに表示されるチームが減るので、いい感じに動くようにしてほしい!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ほんとですね...
サーバーで検索機能ができるまでは上で言われたように、ContestTeams.vue
側で検索機能を実装することにしました
@@ -6,13 +6,14 @@ import BaseButton from '/@/components/UI/BaseButton.vue' | |||
import AccountItem from '/@/components/UserAccounts/AccountItem.vue' | |||
import { ref } from 'vue' | |||
import apis from '/@/lib/apis' | |||
import useUserDataFetcher from '/@/use/userDataFetcher' | |||
import { RouterLink } from 'vue-router' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:kansya:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
よさそうです。
close #9
useFetcher
が上手く動かなかったのでuseUserDataFetcher
に寄せて修正しました