fix missing card background and format code

This commit is contained in:
pompurin404 2024-09-06 20:42:42 +08:00
parent c46a26192a
commit 1285a07623
No known key found for this signature in database
14 changed files with 64 additions and 33 deletions

View File

@ -118,18 +118,19 @@ const App: React.FC = () => {
} }
const navigateMap = { const navigateMap = {
sysproxy: "sysproxy", sysproxy: 'sysproxy',
tun: "tun", tun: 'tun',
profile: "profiles", profile: 'profiles',
proxy: "proxies", proxy: 'proxies',
mihomo: "mihomo", mihomo: 'mihomo',
connection: "connections", connection: 'connections',
dns: "dns", dns: 'dns',
sniff: "sniffer", sniff: 'sniffer',
log: "logs", log: 'logs',
rule: "rules", rule: 'rules',
resource: "resources", resource: 'resources',
override: "override" override: 'override',
substore: 'substore'
} }
const componentMap = { const componentMap = {

View File

@ -177,7 +177,9 @@ const ConnCard: React.FC = () => {
<> <>
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">
@ -224,7 +226,9 @@ const ConnCard: React.FC = () => {
) : ( ) : (
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -43,7 +43,9 @@ const DNSCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -32,7 +32,9 @@ const LogCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -56,7 +56,9 @@ const MihomoCoreCard: React.FC = () => {
{mihomoCoreCardStatus === 'col-span-2' ? ( {mihomoCoreCardStatus === 'col-span-2' ? (
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody> <CardBody>
@ -105,7 +107,9 @@ const MihomoCoreCard: React.FC = () => {
) : ( ) : (
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -34,7 +34,9 @@ const OverrideCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -61,7 +61,9 @@ const ProfileCard: React.FC = () => {
{profileCardStatus === 'col-span-2' ? ( {profileCardStatus === 'col-span-2' ? (
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1"> <CardBody className="pb-1">
@ -150,7 +152,9 @@ const ProfileCard: React.FC = () => {
) : ( ) : (
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -36,7 +36,9 @@ const ProxyCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -33,7 +33,9 @@ const ResourceCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -35,7 +35,9 @@ const RuleCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -44,7 +44,9 @@ const SniffCard: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -1,5 +1,5 @@
import { Button, Card, CardBody, CardFooter } from '@nextui-org/react' import { Button, Card, CardBody, CardFooter } from '@nextui-org/react'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { useSortable } from '@dnd-kit/sortable' import { useSortable } from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities' import { CSS } from '@dnd-kit/utilities'
import SubStoreIcon from '../base/substore-icon' import SubStoreIcon from '../base/substore-icon'
@ -7,7 +7,6 @@ import { useAppConfig } from '@renderer/hooks/use-app-config'
const SubStoreCard: React.FC = () => { const SubStoreCard: React.FC = () => {
const { appConfig } = useAppConfig() const { appConfig } = useAppConfig()
const { substoreCardStatus = 'col-span-1', useSubStore = true } = appConfig || {} const { substoreCardStatus = 'col-span-1', useSubStore = true } = appConfig || {}
const navigate = useNavigate()
const location = useLocation() const location = useLocation()
const match = location.pathname.includes('/substore') const match = location.pathname.includes('/substore')
const { const {
@ -32,13 +31,14 @@ const SubStoreCard: React.FC = () => {
className={`${substoreCardStatus} ${!useSubStore ? 'hidden' : ''}`} className={`${substoreCardStatus} ${!useSubStore ? 'hidden' : ''}`}
> >
<Card <Card
ref={setNodeRef}
{...attributes}
{...listeners}
fullWidth fullWidth
className={`${match ? 'bg-primary' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
isPressable
onPress={() => navigate('/substore')}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">
<div ref={setNodeRef} {...attributes} {...listeners} className="flex justify-between"> <div className="flex justify-between">
<Button <Button
isIconOnly isIconOnly
className="bg-transparent pointer-events-none" className="bg-transparent pointer-events-none"

View File

@ -47,7 +47,9 @@ const SysproxySwitcher: React.FC = () => {
> >
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">

View File

@ -84,7 +84,9 @@ const TunSwitcher: React.FC = () => {
<Card <Card
fullWidth fullWidth
ref={setNodeRef} {...attributes} {...listeners} ref={setNodeRef}
{...attributes}
{...listeners}
className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`} className={`${match ? 'bg-primary' : 'hover:bg-primary/30'} ${isDragging ? 'scale-[0.97] tap-highlight-transparent' : ''}`}
> >
<CardBody className="pb-1 pt-0 px-0"> <CardBody className="pb-1 pt-0 px-0">