mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix substore copy
This commit is contained in:
parent
6dda0c459f
commit
c440cfac53
@ -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>
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user