feat: 添加 PWA 插件支持,更新环境变量处理,优化可见性选项

This commit is contained in:
xiongxiao
2026-03-18 17:00:49 +08:00
committed by cnb
parent 0b08b82356
commit bc9ce9e5df
6 changed files with 31 additions and 15 deletions

View File

@@ -19,4 +19,14 @@ export const getDynamicBasename = (): string => {
}
// 默认使用构建时的 basename
return basename
}
export const openLink = (path: string, target: string = '_self') => {
if (path.startsWith('http://') || path.startsWith('https://')) {
window.open(path, target);
return;
}
const url = new URL(path, window.location.origin);
url.pathname = wrapBasename(url.pathname);
window.open(url.toString(), target);
}

View File

@@ -83,7 +83,6 @@ export const BaseHeader = (props: { main?: React.ComponentType | null }) => {
{meInfo}
</div>
</div>
<hr />
</>
)
}

View File

@@ -49,7 +49,7 @@ export function CreateRepoDialog({ open, onOpenChange }: CreateRepoDialogProps)
path: '',
license: '',
description: '',
visibility: 'public'
visibility: 'Public'
})
}
}, [open, reset])
@@ -104,16 +104,16 @@ export function CreateRepoDialog({ open, onOpenChange }: CreateRepoDialogProps)
<Controller
name="visibility"
control={control}
defaultValue="public"
render={({ field }) => (
<Select {...field}>
defaultValue="Public"
render={({ field: { onChange, value } }) => (
<Select onValueChange={onChange} value={value}>
<SelectTrigger id="visibility">
<SelectValue placeholder="选择可见性" />
</SelectTrigger>
<SelectContent>
<SelectItem value="public"> (public)</SelectItem>
<SelectItem value="private"> (private)</SelectItem>
<SelectItem value="protected"> (protected)</SelectItem>
<SelectItem value="Public"> (public)</SelectItem>
<SelectItem value="Private"> (private)</SelectItem>
<SelectItem value="Protected"> (protected)</SelectItem>
</SelectContent>
</Select>
)}