mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-08 18:56:37 +08:00
fix(ui): improve background handling and PWA update prompts
- Add adaptive solid color background support for dark/light themes. - Replace mesh gradient with semi-transparent blurred background images. - Fix background scrolling issue on mobile browsers. - Remove borders from specific cards for consistent UI styling. - Prevent caching of PWA service worker files in Nginx. - Introduce interactive toast prompt for PWA updates instead of silent refresh.
This commit is contained in:
@@ -621,10 +621,13 @@ export default function ConfigPage() {
|
||||
|
||||
const renderBgImageUploader = () => {
|
||||
const bgImage = configs["app_bg_image"] || "";
|
||||
const isImage = bgImage.startsWith("http") || bgImage.startsWith("data:") || bgImage.startsWith("/") || bgImage.startsWith("blob:");
|
||||
const isTheme = bgImage === "theme";
|
||||
const isSolidColor = bgImage && !isImage && !isTheme;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4 w-full">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
@@ -638,7 +641,23 @@ export default function ConfigPage() {
|
||||
onPress={() => bgImageFileInputRef.current?.click()}
|
||||
isLoading={bgImageUploading}
|
||||
>
|
||||
选择图片
|
||||
上传图片
|
||||
</Button>
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="flat"
|
||||
onPress={() => handleConfigChange("app_bg_image", "theme")}
|
||||
isDisabled={bgImageUploading || isTheme}
|
||||
>
|
||||
自适应纯色 (跟随深色模式)
|
||||
</Button>
|
||||
<Button
|
||||
color="default"
|
||||
variant="flat"
|
||||
onPress={() => handleConfigChange("app_bg_image", "#ffffff")}
|
||||
isDisabled={bgImageUploading || bgImage === "#ffffff"}
|
||||
>
|
||||
白色纯色
|
||||
</Button>
|
||||
{bgImage && (
|
||||
<Button
|
||||
@@ -647,11 +666,12 @@ export default function ConfigPage() {
|
||||
onPress={() => handleConfigChange("app_bg_image", "")}
|
||||
isDisabled={bgImageUploading}
|
||||
>
|
||||
清除背景
|
||||
恢复默认
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
{bgImage && (
|
||||
|
||||
{bgImage && isImage && (
|
||||
<div className="relative rounded-xl overflow-hidden border border-divider">
|
||||
<img
|
||||
src={bgImage}
|
||||
@@ -663,6 +683,23 @@ export default function ConfigPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{bgImage && isTheme && (
|
||||
<div className="relative rounded-xl border border-divider bg-background h-32 flex items-center justify-center">
|
||||
<span className="text-foreground text-sm font-medium">当前为自适应纯色背景</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{bgImage && isSolidColor && (
|
||||
<div
|
||||
className="relative rounded-xl border border-divider h-32 flex items-center justify-center"
|
||||
style={{ backgroundColor: bgImage }}
|
||||
>
|
||||
<span className="text-gray-500 bg-white/80 dark:bg-black/80 px-2 py-1 rounded text-sm font-medium border border-gray-200 dark:border-gray-800 shadow-sm">
|
||||
纯色背景 ({bgImage})
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -327,7 +327,7 @@ export default function LimitPage() {
|
||||
<StaggerList className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4">
|
||||
{filteredRules.map((rule) => (
|
||||
<StaggerItem key={rule.id}>
|
||||
<Card className="shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden h-full">
|
||||
<Card className="shadow-sm overflow-hidden h-full">
|
||||
<CardHeader className="pb-2 md:pb-2">
|
||||
<div className="flex justify-between items-start w-full">
|
||||
<div>
|
||||
@@ -413,7 +413,7 @@ export default function LimitPage() {
|
||||
)
|
||||
) : (
|
||||
/* 空状态 */
|
||||
<Card className="shadow-sm border border-gray-200 dark:border-gray-700 bg-default-50/50">
|
||||
<Card className="shadow-sm bg-default-50/50">
|
||||
<CardBody className="text-center py-20 flex flex-col items-center justify-center min-h-[240px]">
|
||||
<h3 className="text-xl font-medium text-foreground tracking-tight mb-2">
|
||||
暂无限速规则
|
||||
|
||||
Reference in New Issue
Block a user