fix substore copy
Some checks are pending
Build / windows (arm64) (push) Waiting to run
Build / windows (ia32) (push) Waiting to run
Build / windows (x64) (push) Waiting to run
Build / linux (arm64) (push) Waiting to run
Build / linux (x64) (push) Waiting to run
Build / macos (arm64) (push) Waiting to run
Build / macos (x64) (push) Waiting to run
Build / updater (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-bin) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron-bin) (push) Blocked by required conditions
Build / aur-git-updater (push) Waiting to run

This commit is contained in:
pompurin404 2024-09-04 23:18:07 +08:00
parent 6dda0c459f
commit c440cfac53
No known key found for this signature in database
2 changed files with 33 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import { import {
Button, Button,
Checkbox, Checkbox,
Chip,
Divider, Divider,
Dropdown, Dropdown,
DropdownItem, DropdownItem,
@ -67,10 +68,10 @@ const Profiles: React.FC = () => {
useSubStore ? subStoreCollections : (): undefined => {} useSubStore ? subStoreCollections : (): undefined => {}
) )
const subStoreMenuItems = useMemo(() => { const subStoreMenuItems = useMemo(() => {
const items: { icon?: ReactNode; key: string; name: string; divider: boolean }[] = [ const items: { icon?: ReactNode; key: string; children: ReactNode; divider: boolean }[] = [
{ {
key: 'open-substore', key: 'open-substore',
name: '访问 Sub-Store', children: '访问 Sub-Store',
icon: <SubStoreIcon className="text-lg" />, icon: <SubStoreIcon className="text-lg" />,
divider: divider:
(Boolean(subs) && subs.length > 0) || (Boolean(collections) && collections.length > 0) (Boolean(subs) && subs.length > 0) || (Boolean(collections) && collections.length > 0)
@ -80,7 +81,20 @@ const Profiles: React.FC = () => {
subs.forEach((sub, index) => { subs.forEach((sub, index) => {
items.push({ items.push({
key: `sub-${sub.name}`, key: `sub-${sub.name}`,
name: sub.displayName || sub.name, children: (
<div className="flex justify-between">
<div>{sub.displayName || sub.name}</div>
<div>
{sub.tag?.map((tag) => {
return (
<Chip key={tag} size="sm" className="ml-1" radius="sm">
{tag}
</Chip>
)
})}
</div>
</div>
),
icon: sub.icon ? <img src={sub.icon} className="h-[18px] w-[18px]" /> : null, icon: sub.icon ? <img src={sub.icon} className="h-[18px] w-[18px]" /> : null,
divider: index === subs.length - 1 && Boolean(collections) && collections.length > 0 divider: index === subs.length - 1 && Boolean(collections) && collections.length > 0
}) })
@ -90,7 +104,20 @@ const Profiles: React.FC = () => {
collections.forEach((sub) => { collections.forEach((sub) => {
items.push({ items.push({
key: `collection-${sub.name}`, key: `collection-${sub.name}`,
name: sub.displayName || sub.name, children: (
<div className="flex justify-between">
<div>{sub.displayName || sub.name}</div>
<div>
{sub.tag?.map((tag) => {
return (
<Chip key={tag} size="sm" className="ml-1" radius="sm">
{tag}
</Chip>
)
})}
</div>
</div>
),
icon: sub.icon ? <img src={sub.icon} className="h-[18px] w-[18px]" /> : null, icon: sub.icon ? <img src={sub.icon} className="h-[18px] w-[18px]" /> : null,
divider: false divider: false
}) })
@ -313,7 +340,7 @@ const Profiles: React.FC = () => {
> >
{subStoreMenuItems.map((item) => ( {subStoreMenuItems.map((item) => (
<DropdownItem startContent={item?.icon} key={item.key} showDivider={item.divider}> <DropdownItem startContent={item?.icon} key={item.key} showDivider={item.divider}>
{item.name} {item.children}
</DropdownItem> </DropdownItem>
))} ))}
</DropdownMenu> </DropdownMenu>

View File

@ -42,6 +42,7 @@ const SubStore: React.FC = () => {
> >
<iframe <iframe
className="w-full h-full" className="w-full h-full"
allow="clipboard-write"
src={`https://sub-store.vercel.app?api=${useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${port}`}`} src={`https://sub-store.vercel.app?api=${useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${port}`}`}
/> />
</BasePage> </BasePage>