Skip to content

Commit d370168

Browse files
committed
feat(checkin): add checkin button in panels
1 parent 15730c9 commit d370168

14 files changed

+437
-221
lines changed

src/components/AppComponent.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const onBack = () => {
5656
</script>
5757

5858
<template>
59-
<div ref="appRef">
59+
<div ref="appRef" class="container">
6060
<NDialogProvider :to="appRef">
6161
<header :class="{ open: panel }">
6262
<RouterView v-slot="{ Component }" name="navbar">
@@ -173,6 +173,10 @@ footer {
173173
width: 100%;
174174
}
175175
176+
.container {
177+
height: 100%;
178+
}
179+
176180
.panel {
177181
position: relative;
178182
max-height: calc(100% - #{layout.$header-navbar-height});

src/components/common/list/ListEmpty.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const emit = defineEmits<{
5353
transition: color 0.3s var(--n-bezier);
5454
5555
.page {
56-
color: var(--primary-color-disabled);
56+
color: var(--color-primary-disabled);
5757
font-weight: bold;
5858
}
5959
}

src/components/common/list/ListLoadMore.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const emit = defineEmits<{
6262
transition: color 0.3s var(--n-bezier);
6363
6464
.page {
65-
color: var(--primary-color-disabled);
65+
color: var(--color-primary-disabled);
6666
font-weight: bold;
6767
}
6868
}

src/components/common/typography/TextField.vue

+2
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ const { openTab } = useLinksStore();
9393
9494
.value {
9595
flex: 1 1 auto;
96+
min-width: max-content;
9697
}
9798
9899
.detail {
99100
flex: var(--text-flex);
100101
align-items: baseline;
102+
min-width: max-content;
101103
102104
&:hover .prefix {
103105
color: var(--white-70);
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
3+
<g
4+
fill="none"
5+
stroke="currentColor"
6+
stroke-linecap="round"
7+
stroke-linejoin="round"
8+
stroke-width="1.5"
9+
>
10+
<path
11+
stroke-dasharray="60"
12+
stroke-dashoffset="60"
13+
d="M3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
14+
>
15+
<animate
16+
fill="freeze"
17+
attributeName="stroke-dashoffset"
18+
dur="0.5s"
19+
values="60;0"
20+
/>
21+
</path>
22+
<path stroke-dasharray="14" stroke-dashoffset="14" d="M8 12L11 15L16 10">
23+
<animate
24+
fill="freeze"
25+
attributeName="stroke-dashoffset"
26+
begin="0.6s"
27+
dur="0.2s"
28+
values="14;0"
29+
/>
30+
</path>
31+
</g>
32+
</svg>
33+
</template>

src/components/views/panel/MoviePanelButtons.vue

+42-21
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import IconListEmpty from '~/components/icons/IconListEmpty.vue';
99
import IconPlay from '~/components/icons/IconPlay.vue';
1010
import IconPlayFilled from '~/components/icons/IconPlayFilled.vue';
1111
import PanelButtonProgress from '~/components/views/panel/PanelButtonProgress.vue';
12+
import PanelSelectProgress from '~/components/views/panel/PanelSelectProgress.vue';
1213
import {
1314
PanelButtonsOption,
1415
type PanelButtonsOptions,
@@ -51,15 +52,29 @@ const props = defineProps({
5152
type: Boolean,
5253
required: false,
5354
},
55+
watching: {
56+
type: Boolean,
57+
required: false,
58+
},
59+
watchProgress: {
60+
type: Number,
61+
required: false,
62+
},
63+
checkinLoading: {
64+
type: Boolean,
65+
required: false,
66+
},
5467
});
5568
5669
const emit = defineEmits<{
5770
(e: 'onListUpdate', value: ListEntity['id'], remove: boolean): void;
5871
(e: 'onCollectionUpdate', value: PanelButtonsOptions, date?: number): void;
5972
(e: 'onWatchedUpdate', value: PanelButtonsOptions, date?: number): void;
73+
(e: 'onCheckin', cancel: boolean): void;
6074
}>();
6175
62-
const { watched, collected, activeLoading, activeLists, hasRelease } = toRefs(props);
76+
const { watched, collected, activeLoading, activeLists, hasRelease, watching } =
77+
toRefs(props);
6378
6479
const onListUpdate = (value: ListEntity['id'] | ListEntity['id'][]) => {
6580
const newList = Array.isArray(value) ? value : [value];
@@ -123,16 +138,16 @@ const listOptions = computed(
123138
})),
124139
);
125140
126-
onMounted(() => {
127-
fetchLists();
128-
});
141+
const onCheckin = () => emit('onCheckin', watching.value);
142+
143+
onMounted(() => fetchLists());
129144
</script>
130145

131146
<template>
132147
<div ref="root" class="panel-buttons">
133148
<!-- List -->
134149
<NFlex class="button-container list" justify="center" align="center">
135-
<PanelButtonProgress
150+
<PanelSelectProgress
136151
:options="listOptions"
137152
:value="activeLists"
138153
:select="{
@@ -157,12 +172,12 @@ onMounted(() => {
157172
</NFlex>
158173
</template>
159174
{{ i18n(`label__list__${ activeLists?.length ? 'update' : 'add' }`) }}
160-
</PanelButtonProgress>
175+
</PanelSelectProgress>
161176
</NFlex>
162177

163178
<!-- Collection -->
164179
<NFlex class="button-container collection" justify="center" align="center">
165-
<PanelButtonProgress
180+
<PanelSelectProgress
166181
:select="{
167182
options: collectionOptions,
168183
}"
@@ -173,12 +188,12 @@ onMounted(() => {
173188
@on-select="onCollectionUpdate"
174189
>
175190
{{ i18n(`label__collection__${ collected ? 'remove' : 'add' }`) }}
176-
</PanelButtonProgress>
191+
</PanelSelectProgress>
177192
</NFlex>
178193

179194
<!-- History -->
180195
<NFlex class="button-container history" justify="center" align="center">
181-
<PanelButtonProgress
196+
<PanelSelectProgress
182197
:select="{
183198
options: watchedOptions,
184199
}"
@@ -188,6 +203,18 @@ onMounted(() => {
188203
@on-select="onWatchedUpdate"
189204
>
190205
{{ i18n(`label__history__${ watched ? 'remove' : 'add' }`) }}
206+
</PanelSelectProgress>
207+
</NFlex>
208+
209+
<!-- Check-in -->
210+
<NFlex class="button-container checkin" justify="center" align="center">
211+
<PanelButtonProgress
212+
:filled="watching"
213+
:percentage="watchProgress"
214+
:loading="checkinLoading"
215+
@click="onCheckin"
216+
>
217+
{{ i18n('checkin', 'common', 'button') }}
191218
</PanelButtonProgress>
192219
</NFlex>
193220
</div>
@@ -207,18 +234,6 @@ onMounted(() => {
207234
i {
208235
margin-left: calc(0% - var(--n-icon-margin));
209236
}
210-
211-
&.history {
212-
min-width: 10.125rem;
213-
}
214-
215-
&.collection {
216-
min-width: 11.375rem;
217-
}
218-
219-
&.list {
220-
min-width: 8.875rem;
221-
}
222237
}
223238
}
224239
@@ -227,4 +242,10 @@ onMounted(() => {
227242
gap: 1.25rem 3rem;
228243
}
229244
}
245+
246+
@media (width < 660px) {
247+
.button-container {
248+
min-width: 45%;
249+
}
250+
}
230251
</style>

0 commit comments

Comments
 (0)