Skip to content

Commit e8494a1

Browse files
committed
Merge remote-tracking branch 'origin/feature/177-tos' into feature/177-tos
2 parents 3f7c662 + 95725f3 commit e8494a1

File tree

6 files changed

+50
-111
lines changed

6 files changed

+50
-111
lines changed

src/components/PeriodCard.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
</div>
1414
<v-row>
1515
<v-col v-for="(item, i) in classData" :key="i" cols="12" md="6">
16-
<content-card :lesson="item" />
16+
<content-card
17+
:lesson="item"
18+
:editable="editable"
19+
@clickEditButton="$emit('clickEditButton', item)"
20+
/>
1721
</v-col>
1822
</v-row>
1923
</div>
@@ -41,6 +45,10 @@ export default Vue.extend({
4145
classData: {
4246
type: Array as () => classData.LessonWithId[],
4347
default: () => []
48+
},
49+
editable: {
50+
type: Boolean,
51+
default: false
4452
}
4553
},
4654
computed: {

src/components/PeriodCardEditable.vue

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/layouts/simple.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<v-app-bar fixed app class="bar" elevation="0">
99
<HeaderLogo />
1010
<v-spacer />
11-
<v-btn outlined rounded color="#0071C2">
11+
<v-btn outlined rounded color="#0071C2" @click="$router.back()">
1212
<v-icon left>mdi-arrow-left</v-icon>
1313
もどる
1414
</v-btn>

src/pages/edit/index.vue

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<template>
22
<div class="MainPage">
33
<div v-if="classData.lessonsOnCurrentDate.length">
4-
<period-card-editable :class-data="classData" @clickEditButton="doEdit" />
4+
<period-card
5+
v-for="(lessons, time, index) in lessonsGroupByPeriod"
6+
:key="index"
7+
:period="index"
8+
:time="time"
9+
:class-data="lessons"
10+
:editable="true"
11+
@clickEditButton="doEdit"
12+
/>
513
<ul class="Classes-List">
614
<li>おうちで時間割について</li>
715
<li>お問い合わせ</li>
@@ -44,20 +52,31 @@ import Vue from 'vue'
4452
import dayjs from 'dayjs'
4553
import isToday from 'date-fns/isToday'
4654
import { vxm } from '@/store'
47-
import PeriodCardEditable from '@/components/PeriodCardEditable.vue'
55+
import PeriodCard from '@/components/PeriodCard.vue'
4856
import SimpleBottomSheet from '@/components/SimpleBottomSheet.vue'
4957
import EditingScreen from '@/components/EditingScreen.vue'
50-
import { classData } from '~/types/store/classData'
58+
import { classData } from '@/types/store/classData'
59+
import LessonWithId = classData.LessonWithId
60+
61+
type LessonsGroupedBy = {
62+
[key: string]: LessonWithId[]
63+
}
5164
5265
type DataType = {
5366
classData: typeof vxm.classData
5467
editingMode: boolean
5568
editPageValue: object
5669
}
5770
71+
type Computed = {
72+
today: boolean
73+
dateTitle: string
74+
lessonsGroupByPeriod: LessonsGroupedBy
75+
}
76+
5877
export default Vue.extend({
5978
components: {
60-
PeriodCardEditable,
79+
PeriodCard,
6180
SimpleBottomSheet,
6281
EditingScreen
6382
},
@@ -100,6 +119,16 @@ export default Vue.extend({
100119
},
101120
dateTitle() {
102121
return dayjs(vxm.app.currentDate).format('M/D')
122+
},
123+
lessonsGroupByPeriod() {
124+
const groupBy = (targets: LessonWithId[], key: keyof LessonWithId) =>
125+
targets.reduce((acc: LessonsGroupedBy, currentLesson: LessonWithId) => {
126+
const valueToGroup = currentLesson[key].toString()
127+
acc[valueToGroup] = acc[valueToGroup] || []
128+
acc[valueToGroup].push(currentLesson)
129+
return acc
130+
}, {})
131+
return groupBy(vxm.classData.lessonsOnCurrentDate, 'startTime')
103132
}
104133
},
105134
methods: {

src/pages/user/login.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
text
4747
to="/"
4848
>
49-
<span>パスワードを忘れた方へ</span>
49+
<span>戻る</span>
5050
</v-btn>
5151
</div>
5252
</template>

src/store/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import Vue from 'vue'
2-
import Vuex, { ActionContext } from 'vuex'
3-
import { Context } from '@nuxt/types/app'
2+
import Vuex from 'vuex'
3+
// import Vuex, { ActionContext } from 'vuex'
4+
// import { Context } from '@nuxt/types/app'
45
import { createProxy, extractVuexModule } from 'vuex-class-component'
5-
import jwtDecode from 'jwt-decode'
6+
// import jwtDecode from 'jwt-decode'
67
import { AppStore } from '@/store/modules/app'
78
import { ClassDataStore } from '@/store/modules/classData'
89
import { UserStore } from '@/store/modules/user'
@@ -16,7 +17,7 @@ export const store = new Vuex.Store({
1617
...extractVuexModule(UserStore)
1718
}
1819
})
19-
20+
/*
2021
export const actions = {
2122
async nuxtServerInit(_ctx: ActionContext<any, any>, { req }: Context) {
2223
const authorizationHeader = req.headers.authorization || ''
@@ -29,6 +30,7 @@ export const actions = {
2930
}
3031
}
3132
}
33+
*/
3234

3335
export const vxm = {
3436
app: createProxy(store, AppStore),

0 commit comments

Comments
 (0)