Merge pull request #492 from hakadao/main

sync: main to dev
This commit is contained in:
Hakadao
2024-04-08 14:56:42 +08:00
committed by GitHub
9 changed files with 92 additions and 47 deletions

View File

@@ -19,6 +19,6 @@ jobs:
token: ${{ secrets.RELEASE_TOKEN }}
release-type: node
package-name: release-please-action
release-as: 0.16.0
release-as: 0.16.1
signoff: 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>'
changelog-types: '[{"type":"types","section":"Types","hidden":false},{"type":"revert","section":"Reverts","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"improvement","section":"Feature Improvements","hidden":false},{"type":"docs","section":"Docs","hidden":false},{"type":"i18n","section":"I18n","hidden":true},{"type":"style","section":"Style Changes","hidden":false},{"type":"ci","section":"CI","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"contributor","section":"New Contributors","hidden":false},{"type":"notice","section":"Notices","hidden":false}]'

View File

@@ -1,5 +1,24 @@
# Changelog
## [0.16.1](https://github.com/hakadao/BewlyBewly/compare/v0.16.0...v0.16.1) (2024-04-08)
### Features
* adjust dialog styles && add tertiary type to button ([020889f](https://github.com/hakadao/BewlyBewly/commit/020889f8474c812392194210684a8603066b6a6d))
### Bug Fixes
* **ForYou:** Fix issue with dislike functionality in ForYou.vue component ([1074834](https://github.com/hakadao/BewlyBewly/commit/10748340672dc12cc18e646410fbac2cd27e031b))
* **MorePop:** add missing watch later entry ([b657fed](https://github.com/hakadao/BewlyBewly/commit/b657fedc74f571c4bfc2a6b07eb0fdb3ae4bdc1f))
* **VideoCard:** correct styling distortion when in horizontal mode ([f9be380](https://github.com/hakadao/BewlyBewly/commit/f9be38047194b91f7d2c1be8565cf6f987adef44))
### Style Changes
* **Dialog:** adjust dialog styles ([b39e876](https://github.com/hakadao/BewlyBewly/commit/b39e876148cfd8d8eba7e4bfaf64b9e5ae5d1af6))
## [0.16.0](https://github.com/hakadao/BewlyBewly/compare/v0.15.5...v0.16.0) (2024-04-07)

View File

@@ -1,7 +1,7 @@
{
"name": "bewly-bewly",
"displayName": "BewlyBewly",
"version": "0.16.0",
"version": "0.16.1",
"private": true,
"packageManager": "pnpm@8.15.3",
"description": "Just make a few small changes to your Bilibili homepage.",

View File

@@ -3,6 +3,7 @@ interface Props {
type?: | 'default'
| 'primary'
| 'secondary'
| 'tertiary'
| 'info'
| 'success'
| 'warning'
@@ -92,6 +93,12 @@ function handleClick(evt: MouseEvent) {
--b-button-text-color: var(--bew-text-1);
}
&--type-tertiary {
--b-button-color: transparent;
--b-button-color-hover: var(--bew-fill-2);
--b-button-text-color: var(--bew-text-1);
}
&--type-error {
--b-button-color: var(--bew-error-color);
--b-button-color-hover: var(--bew-error-color)

View File

@@ -90,12 +90,12 @@ function handleConfirm() {
/>
<div
style="
--un-shadow: var(--bew-shadow-3) var(--bew-shadow-edge-glow-2);
box-shadow: var(--bew-shadow-3) var(--bew-shadow-edge-glow-2);
backdrop-filter: var(--bew-filter-glass-2);
"
:style="{ width: dialogWidth, height: dialogHeight }"
pos="absolute top-1/2 left-1/2" bg="$bew-content-2 dark:$bew-elevated-1" rounded="$bew-radius"
transform="translate--1/2" z-2 shadow overflow="x-hidden y-overlay"
pos="absolute top-1/2 left-1/2" bg="$bew-elevated-1" rounded="$bew-radius"
transform="translate--1/2" z-2 overflow="x-hidden y-overlay"
antialiased
>
<!-- loading masking -->
@@ -113,7 +113,7 @@ function handleConfirm() {
style="
text-shadow: 0 0 15px var(--bew-elevated-solid-1), 0 0 20px var(--bew-elevated-solid-1)
"
pos="sticky top-0 left-0" w-full h-80px px-8 flex
pos="sticky top-0 left-0" w-full h-70px px-8 flex
items-center justify-between
rounded="t-$bew-radius" z-1
>
@@ -141,21 +141,21 @@ function handleConfirm() {
<ic-baseline-clear />
</div>
</header>
<main p="x-8 t-0 b-4" relative>
<main p="x-8 y-2" relative>
<!-- <div h-80px mt--8 /> -->
<slot />
</main>
<footer
:style="{ justifyContent: centerFooter ? 'center' : 'flex-end' }"
flex="~ gap-2" p="8 t-0"
:style="{ justifyContent: centerFooter || center ? 'center' : 'flex-end' }"
flex="~ gap-2" p="x-8 t-6 b-6"
>
<Button type="secondary" size="large" @click="handleClose">
<Button type="tertiary" @click="handleClose">
<div>
{{ $t('common.cancel') }}
<span v-show="showShortcut" text="xs $bew-text-2">(Esc)</span>
</div>
</Button>
<Button type="primary" size="large" @click="handleConfirm">
<Button type="primary" @click="handleConfirm">
<div>
{{ $t('common.confirm') }}
<span v-show="showShortcut" text="xs">(Enter)</span>

View File

@@ -9,6 +9,7 @@ const list = [
{ name: t('topbar.moments'), url: '//t.bilibili.com/' },
{ name: t('topbar.favorites'), url: `//space.bilibili.com/${getUserID ?? ''}/favlist` },
{ name: t('topbar.history'), url: '//www.bilibili.com/account/history' },
{ name: t('topbar.watch_later'), url: '//www.bilibili.com/watchlater/#/list' },
{ name: t('topbar.creative_center'), url: '//member.bilibili.com/platform/home' },
]
</script>

View File

@@ -168,31 +168,33 @@ function handleUndo() {
<template v-if="removed">
<div
:style="{ contentVisibility }"
pos="absolute top-0 left-0" w-full aspect-video
rounded="$bew-radius"
w-full
pos="absolute top-0 left-0" aspect-video
>
<img
:src="`${removeHttpFromUrl(cover)}@672w_378h_1c`" alt=""
w-full h-full object-cover pos="absolute top-0 left-0" aspect-video
z--1 rounded-inherit
>
<div
pos="absolute top-0 left-0" w-full h-full flex="~ col gap-2 items-center justify-center"
bg="$bew-fill-4" backdrop-blur-20px mix-blend-luminosity
>
<p mb-2 color-white text-lg>
{{ $t('home.video_removed') }}
</p>
<Button
color="rgba(255,255,255,.35)" text-color="white" size="small"
@click="handleUndo"
<div :w="wValue" h-fit relative>
<img
:src="`${removeHttpFromUrl(cover)}@672w_378h_1c`" alt=""
w-full h-fit object-cover pos="absolute top-0 left-0" aspect-video
z--1 rounded="$bew-radius"
>
<template #left>
<Icon icon="mingcute:back-line" text-lg />
</template>
{{ $t('common.undo') }}
</Button>
<div
pos="absolute top-0 left-0" w-full h-fit aspect-video flex="~ col gap-2 items-center justify-center"
bg="$bew-fill-4" backdrop-blur-20px mix-blend-luminosity rounded="$bew-radius"
>
<p mb-2 color-white text-lg>
{{ $t('home.video_removed') }}
</p>
<Button
color="rgba(255,255,255,.35)" text-color="white" size="small"
@click="handleUndo"
>
<template #left>
<Icon icon="mingcute:back-line" text-lg />
</template>
{{ $t('common.undo') }}
</Button>
</div>
</div>
</div>
</template>

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import type { Ref } from 'vue'
import { onKeyStroke } from '@vueuse/core'
import { useToast } from 'vue-toastification'
import { Type as ThreePointV2Type } from '~/models/video/appForYou'
import type { AppForYouResult, Item as AppVideoItem, ThreePointV2 } from '~/models/video/appForYou'
import type { Item as VideoItem, forYouResult } from '~/models/video/forYou'
@@ -26,6 +27,8 @@ const gridValue = computed((): string => {
return '~ cols-1 gap-4'
})
const toast = useToast()
const videoList = reactive<VideoItem[]>([])
const appVideoList = reactive<AppVideoItem[]>([])
const isLoading = ref<boolean>(true)
@@ -40,7 +43,7 @@ const videoOptionsPosition = reactive<{ top: string, left: string }>({ top: '0',
const activatedVideoIdx = ref<number>(0)
const activatedVideo = ref<AppVideoItem | null>()
const videoCardRef = ref(null)
const dislikedVideoIds = ref<number[]>([])
const dislikedVideoUniqueKeys = ref<string[]>([])
const showDislikeDialog = ref<boolean>(false)
const selectedDislikeReason = ref<number>(1)
const loadingDislikeDialog = ref<boolean>(false)
@@ -239,12 +242,12 @@ function closeVideoOptions() {
}
function openDislikeDialog() {
selectedDislikeReason.value = 1
showDislikeDialog.value = true
}
function closeDislikeDialog() {
showDislikeDialog.value = false
selectedDislikeReason.value = 1
}
function handleDislike() {
@@ -266,12 +269,16 @@ function handleDislike() {
contentScriptQuery: 'dislikeVideo',
...params,
sign: getTvSign(params),
}).then((res) => {
if (res.code === 0)
dislikedVideoIds.value.push(activatedVideo.value!.idx)
}).finally(() => {
loadingDislikeDialog.value = false
})
.then((res) => {
if (res.code === 0)
activatedVideo.value && dislikedVideoUniqueKeys.value.push(getVideoUniqueKey(activatedVideo.value))
else
toast.error(res.message)
})
.finally(() => {
loadingDislikeDialog.value = false
})
}
function handleUndoDislike(video: AppVideoItem) {
@@ -281,7 +288,7 @@ function handleUndoDislike(video: AppVideoItem) {
id: video.param,
// https://github.com/magicdawn/bilibili-app-recommend/blob/cb51f75f415f48235ce048537f2013122c16b56b/src/components/VideoCard/card.service.ts#L115
idx: (Date.now() / 1000).toFixed(0),
reason_id: 1, // 1 means dislike, e.g. {"id": 1, "name": "不感兴趣","toast": "将减少相似内容推荐"}
reason_id: selectedDislikeReason.value, // 1 means dislike, e.g. {"id": 1, "name": "不感兴趣","toast": "将减少相似内容推荐"}
build: 74800100,
device: 'pad',
mobi_app: 'iphone',
@@ -293,11 +300,21 @@ function handleUndoDislike(video: AppVideoItem) {
...params,
sign: getTvSign(params),
}).then((res) => {
if (res.code === 0)
dislikedVideoIds.value = dislikedVideoIds.value.filter(currentIdx => currentIdx !== video.idx)
if (res.code === 0) {
dislikedVideoUniqueKeys.value = dislikedVideoUniqueKeys.value.filter(currentKey =>
currentKey !== (activatedVideo.value ? getVideoUniqueKey(activatedVideo.value) : ''),
)
}
else {
toast.error(res.message)
}
})
}
function getVideoUniqueKey(video: AppVideoItem) {
return video.idx + (video.bvid || video.uri || '')
}
function jumpToLoginPage() {
location.href = 'https://passport.bilibili.com/login'
}
@@ -346,7 +363,6 @@ defineExpose({ initData })
:title="$t('home.tell_us_why')"
width="400px"
append-to-bewly-body
center-footer
:loading="loadingDislikeDialog"
@close="closeDislikeDialog"
@confirm="handleDislike"
@@ -429,7 +445,7 @@ defineExpose({ initData })
:horizontal="gridLayout !== 'adaptive'"
more-btn
:more-btn-active="video.idx === activatedVideoIdx"
:removed="dislikedVideoIds.includes(video.idx)"
:removed="dislikedVideoUniqueKeys.includes(getVideoUniqueKey(video))"
:dislike-reasons="video.three_point_v2?.find(option => option.type === ThreePointV2Type.Dislike)?.reasons || []"
@more-click="(e) => handleMoreClick(e, video)"
@undo="handleUndoDislike(video)"

View File

@@ -25,7 +25,7 @@ export async function setupApp(app: App) {
transition: 'Vue-Toastification__fade',
maxToasts: 20,
newestOnTop: true,
position: POSITION.TOP_CENTER,
position: POSITION.TOP_RIGHT,
})
app.use(pinia)
}