Skip to content

Commit

Permalink
chore: fix & theme
Browse files Browse the repository at this point in the history
  • Loading branch information
a1mersnow committed Jan 28, 2024
1 parent 61b4c22 commit 28f2024
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
41 changes: 22 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const { state: list, execute: fetchList } = useAsyncState(() => {
})
function handleCheckChange(fileId: string, checked: boolean) {
return uncheckList.value = uncheckList.value.filter(x => x !== fileId || !checked)
if (uncheckList.value.includes(fileId))
uncheckList.value = uncheckList.value.filter(x => x !== fileId || !checked)
else
uncheckList.value = uncheckList.value.concat(fileId)
}
// 剧集模式下使用该列表
Expand Down Expand Up @@ -311,7 +314,7 @@ onUnmounted(() => {
<button
v-if="shouldShowEntry"
ref="trigger"
class="mt-2 min-h-61px w-60px flex flex-col items-center justify-center gap-y-1 rounded-lg px-2px py-6px text-purple-600 transition hover:bg-purple-600 hover:text-white"
class="mt-2 min-h-61px w-60px flex flex-col items-center justify-center gap-y-1 rounded-lg px-2px py-6px text-primary-500 transition hover:bg-primary-500 hover:text-white"
@click="handleClickRenameBtn"
>
<i class="i-carbon:batch-job text-xl" />
Expand All @@ -322,7 +325,7 @@ onUnmounted(() => {
<div
v-if="popupVisible"
ref="popup"
class="absolute z-9999 mt-2 w-300px rounded-lg bg-purple-100 p-3 shadow"
class="absolute z-9999 mt-2 w-300px rounded-lg bg-primary-100 p-3 shadow"
@keyup.esc="popupVisible = false"
>
<p class="pb-2">
Expand All @@ -332,13 +335,13 @@ onUnmounted(() => {
<div class="mb-3 flex items-center gap-x-4">
<div class="w-fit flex gap-x-1px overflow-hidden rounded text-xs text-white">
<div
class="cursor-pointer bg-purple px-2 py-1" :class="activeMode === 'extract' ? 'bg-purple-600' : ''"
class="cursor-pointer bg-primary px-2 py-1" :class="activeMode === 'extract' ? 'bg-primary-600' : ''"
@click="activeMode = 'extract'"
>
剧集模式
</div>
<div
class="cursor-pointer bg-purple px-2 py-1" :class="activeMode === 'regexp' ? 'bg-purple-600' : ''"
class="cursor-pointer bg-primary px-2 py-1" :class="activeMode === 'regexp' ? 'bg-primary-600' : ''"
@click="activeMode = 'regexp'"
>
正则模式
Expand All @@ -347,15 +350,15 @@ onUnmounted(() => {

<template v-if="activeMode === 'regexp'">
<a
class="text-xs font-medium text-purple-600 underline"
class="text-xs font-medium text-primary-600 underline"
href="https://regex101.com/"
target="_blank"
>
正则可视化
</a>

<a
class="text-xs font-medium text-purple-600 underline"
class="text-xs font-medium text-primary-600 underline"
href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/replace"
target="_blank"
>
Expand Down Expand Up @@ -386,7 +389,7 @@ onUnmounted(() => {
<label class="mb-1 block flex items-center gap-x-2">
剧名
<i
class="i-ion:dice block text-sm text-purple-700"
class="i-ion:dice block text-sm text-primary-700"
title="随机填充原文件名"
:class="videoList.length ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'"
@click="fillRandomName"
Expand All @@ -408,14 +411,14 @@ onUnmounted(() => {
总共 {{ processData.total }} | 跳过 {{ processData.skip }} | 完成 {{ processData.done }}
</div>

<div v-if="warning" class="text-xs text-purple">
<div v-if="warning" class="text-xs text-primary">
{{ warning }}
</div>
</div>

<div class="flex">
<button
class="flex items-center justify-center gap-x-1 bg-purple-600 px-3 py-2 text-xs text-white btn"
class="flex items-center justify-center gap-x-1 bg-primary-600 px-3 py-2 text-xs text-white btn"
:disabled="disabled || running"
@click="run"
>
Expand All @@ -431,9 +434,9 @@ onUnmounted(() => {
<div
v-if="popupVisible"
ref="previewRef"
class="custom-scrollbar fixed bottom-2 right-0 top-2 z-9999 w-[max(500px,50vw)] overflow-y-auto border-y-3px border-l-3px border-purple-600 rounded-l-lg border-solid bg-white px-4 py-3 font-mono shadow"
class="custom-scrollbar fixed bottom-2 right-0 top-2 z-9999 w-[max(500px,50vw)] overflow-y-auto border-y-3px border-l-3px border-primary-600 rounded-l-lg border-solid bg-white px-4 py-3 font-mono shadow"
>
<div v-if="listLoading" class="absolute inset-0 z-2 flex flex-col items-center justify-center bg-white/80 text-purple-600">
<div v-if="listLoading" class="absolute inset-0 z-2 flex flex-col items-center justify-center bg-white/80 text-primary-600">
<div class="i-carbon:circle-packing animate-spin text-4xl" />
<p class="py-3 text-sm">
正在获取文件列表<span class="absolute">{{ loadingDots }}</span>
Expand All @@ -443,10 +446,10 @@ onUnmounted(() => {
更改后的文件名有冲突!
</div>
<div class="flex items-center gap-x-3 pb-2">
<button class="text-sm text-purple-600" @click="uncheckList = []">
<button class="text-sm text-primary-600" @click="uncheckList = []">
全选
</button>
<button class="text-sm text-purple-600" @click="uncheckList = showList.map(x => x.file_id)">
<button class="text-sm text-primary-600" @click="uncheckList = showList.map(x => x.file_id)">
全不选
</button>
<div v-if="activeMode === 'extract' && videoList.length" class="ml-4 text-sm text-gray-600">
Expand All @@ -458,7 +461,7 @@ onUnmounted(() => {
</div>

<div v-if="showList.length" class="ml-auto text-xs font-sans text-gray-600">
共 <span class="font-bold text-purple-600">{{ showList.length }}</span> 个文件
共 <span class="font-bold text-primary-600">{{ showList.length }}</span> 个文件
</div>
</div>
<ul
Expand All @@ -478,7 +481,7 @@ onUnmounted(() => {
@pick="manualPickName"
/>
</ul>
<div v-else class="py-8 text-center text-xs text-purple-600">
<div v-else class="py-8 text-center text-xs text-primary-600">
当前目录和模式下,没有满足要求的条目~
</div>
</div>
Expand Down Expand Up @@ -514,13 +517,13 @@ onUnmounted(() => {
width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
--at-apply: bg-purple-100;
--at-apply: bg-primary-100;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
--at-apply: bg-purple-400 rounded-full transition;
--at-apply: bg-primary-400 rounded-full transition;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
--at-apply: bg-purple-600;
--at-apply: bg-primary-600;
}
</style>
4 changes: 2 additions & 2 deletions src/components/PreviewEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const checked = defineModel<boolean>()
checked && newName && !isSame ? 'i-carbon:checkbox-checked-filled' : 'i-carbon:checkbox',
disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',
]"
class="text-sm text-purple-600"
class="text-sm text-primary-600"
@click="checked = !checked"
/>
<span :title="oldName" class="truncate whitespace-pre">
Expand All @@ -39,7 +39,7 @@ const checked = defineModel<boolean>()
@click="emit('pick', id)"
/>
</span>
<span v-if="!isSame" class="i-carbon:arrow-right justify-self-center text-purple-600" />
<span v-if="!isSame" class="i-carbon:arrow-right justify-self-center text-primary-600" />
<span v-else class="i-carbon:arrows-horizontal justify-self-center text-green-500" />
<span :class="disabled ? 'opacity-50' : ''" :title="newName" class="truncate whitespace-pre">
{{ newName }}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function getNewNameByExp(oldName: string, from: string, to: string) {
}
}

export const SeasonEpisodeExtract = /S(?:eason)?[._\- ]?([0-9]{1,3})(?![0-9])(?:[._\- ]?E|[._\- ])([0-9]{1,3})(?![0-9])|E([0-9]{1,3})(?![0-9])|EP([0-9]{1,3})(?![0-9])|(?<![0-9])([0-9]{1,3})(?![0-9])/i
export const SeasonEpisodeExtract = /S(?:eason)?[._\- ]?([0-9]{1,3})(?![0-9])(?:[._\- ]?E|[._\- ])([0-9]{1,3})(?![0-9])|E([0-9]{1,3})(?![0-9])|EP([0-9]{1,3})(?![0-9])|(?<![0-9])([0-9]{1,3})(?=$|\.)/i

export function getNewNameByExtract(oldName: string, prefix: string, season: string) {
const [_, _s, epm1, epm2, epm3, epm4] = oldName.match(SeasonEpisodeExtract) || []
Expand Down
20 changes: 19 additions & 1 deletion uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,26 @@ import {
} from 'unocss'

export default defineConfig({
theme: {
colors: {
primary: {
50: '#edf2ff',
100: '#dee8ff',
200: '#c4d4ff',
300: '#a0b8ff',
400: '#7088ff',
500: '#5b6af9',
600: '#3d40ee',
700: '#302fd3',
800: '#292baa',
900: '#292d86',
950: '#18184e',
DEFAULT: '#7088ff',
},
},
},
shortcuts: [
['btn', 'px-1 py-1 rounded inline-block text-purple-600 hover:text-white hover:bg-purple-600 transition border border-current disabled:opacity-50'],
['btn', 'px-1 py-1 rounded inline-block text-primary-600 hover:text-white hover:bg-primary-600 transition border border-current disabled:opacity-50'],
],
presets: [
presetUno(),
Expand Down

0 comments on commit 28f2024

Please sign in to comment.