Skip to content

Commit

Permalink
視聴ページの大枠を作った
Browse files Browse the repository at this point in the history
  • Loading branch information
mehm8128 committed Aug 20, 2023
1 parent 596ae55 commit 163409e
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/components/CommentPanel/CommentControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const toggleIsAnonymous = () => {
}
const sendComment = () => {
//todo:コメントを送信する
console.log(commentValue.value)

Check warning on line 18 in src/components/CommentPanel/CommentControls.vue

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
console.log(pickedColor.value)

Check warning on line 19 in src/components/CommentPanel/CommentControls.vue

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
console.log(isAnonymous.value)

Check warning on line 20 in src/components/CommentPanel/CommentControls.vue

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
commentValue.value = ''
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/components/CommentPanel/CommentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const emit = defineEmits<{
height: calc(100% - 160px);
}
.commentPanel {
width: 340px;
width: 30rem;
height: 100vh;
border-left: 1px solid $color-secondary;
}
Expand Down
49 changes: 49 additions & 0 deletions src/components/StampList/StampList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
export interface Stamp {
stampId: string
stampName: string
image: string
}
defineProps<{
stamps: Stamp[]
}>()
const handlePutStamp = (stampId: string) => {
console.log(`stamp: ${stampId}`)

Check warning on line 13 in src/components/StampList/StampList.vue

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
}
</script>

<template>
<ul :class="$style.stampList">
<li v-for="stamp in stamps" :key="stamp.stampId" :class="$style.stamp">
<button
:class="$style.stampButton"
@click="handlePutStamp(stamp.stampId)"
>
<img
:src="stamp.image"
:alt="stamp.stampName"
:width="100"
:height="100"
/>
</button>
</li>
</ul>
</template>

<style lang="scss" module>
.stampList {
display: flex;
list-style: none;
}
.stamp {
padding: 0;
}
.stampButton {
padding: 0 0.5rem;
&:hover {
background-color: gray; // fixme: 下部になぜかpaddingらしきものがついている
}
}
</style>
74 changes: 74 additions & 0 deletions src/pages/EventPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import apis, { Meeting, Comment } from '@/lib/apis'
import { parseId } from '@/lib/parsePathParams'

Check failure on line 5 in src/pages/EventPage.vue

View workflow job for this annotation

GitHub Actions / Type Check

Module '"@/lib/parsePathParams"' has no exported member 'parseId'.
import CommentPanel from '@/components/CommentPanel/CommentPanel.vue'
import StampList from '@/components/StampList/StampList.vue'
import { Stamp } from '@/components/StampList/StampList.vue'
const route = useRoute()
const eventId = parseId(route.params.id)
const event = ref<Meeting>()
const comments = ref<Comment[]>([])
const stamps: Stamp[] = Array(10).fill({
stampId: 'aaa',
stampName: 'bbb',
image: 'https://q.trap.jp/api/v3/public/icon/mehm8128'
})
const fetchMeeting = async () => {
//todo: エラーハンドリング
const res = (await apis.getMeeting(eventId)).data
event.value = res
}
const fetchComments = async () => {
//todo: エラーハンドリング
const res = (await apis.getComment(eventId)).data

Check failure on line 28 in src/pages/EventPage.vue

View workflow job for this annotation

GitHub Actions / Type Check

Property 'getComment' does not exist on type 'Apis'.
comments.value = res
}
onMounted(() => {
fetchMeeting()
fetchComments()
})
</script>

<template>
<div :class="$style.container">
<div :class="$style.leftContainer">
<iframe
src="https://www.youtube.com/embed/8Yxrw4GDqg4"
:class="$style.video"
/>
<div :class="$style.stampListContainer">
<stamp-list :stamps="stamps" :class="$style.stampList" />
</div>
</div>
<comment-panel :comments="comments" :show-overlay="false" />

Check failure on line 49 in src/pages/EventPage.vue

View workflow job for this annotation

GitHub Actions / Type Check

Type '{ id: string; username: string; meetingId: string; text: string; createdAt: string; isAnonymous: boolean; color: string; }[]' is not assignable to type 'Comment[]'.
</div>
</template>

<style lang="scss" module>
.container {
display: flex;
justify-content: space-between;
height: 100vh;
}
.leftContainer {
width: 100%;
padding: 1rem 4rem;
}
.video {
width: 100%;
aspect-ratio: 16 / 9;
}
.stampListContainer {
padding-top: 1rem;
}
.stampList {
width: fit-content;
margin: auto auto;
}
</style>
5 changes: 2 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ const routes: RouteRecordRaw[] = [
component: () => import('@/pages/Index.vue')
},
{
path: '/event/:id',
path: '/events/:id',
name: 'Event',
// eslint-disable-next-line @typescript-eslint/no-empty-function
component: () => {} // TODO: ページ作成したらここに書く
component: () => import('@/pages/EventPage.vue')
},
{
path: '/admin/events',
Expand Down

0 comments on commit 163409e

Please sign in to comment.