dark mode for plugins
This commit is contained in:
parent
5c98f1a5aa
commit
463f5a34c6
@ -36,7 +36,7 @@ const CopyBtn = ({
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onMouseLeave={onMouseLeave}
|
onMouseLeave={onMouseLeave}
|
||||||
className={'box-border p-0.5 flex items-center justify-center rounded-md bg-white cursor-pointer'}
|
className={'box-border p-0.5 flex items-center justify-center rounded-md bg-components-button-secondary-bg cursor-pointer'}
|
||||||
style={!isPlain
|
style={!isPlain
|
||||||
? {
|
? {
|
||||||
boxShadow: '0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06)',
|
boxShadow: '0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06)',
|
||||||
@ -44,7 +44,7 @@ const CopyBtn = ({
|
|||||||
: {}}
|
: {}}
|
||||||
onClick={onClickCopy}
|
onClick={onClickCopy}
|
||||||
>
|
>
|
||||||
<div className={`w-6 h-6 rounded-md hover:bg-gray-50 ${s.copyIcon} ${isCopied ? s.copied : ''}`}></div>
|
<div className={`w-6 h-6 rounded-md hover:bg-components-button-secondary-bg-hover ${s.copyIcon} ${isCopied ? s.copied : ''}`}></div>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,7 +32,7 @@ const CardWrapper = ({
|
|||||||
if (showInstallButton) {
|
if (showInstallButton) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='group relative rounded-xl cursor-pointer'
|
className='group relative rounded-xl cursor-pointer hover:bg-components-panel-on-panel-item-bg-hover'
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
key={plugin.name}
|
key={plugin.name}
|
||||||
@ -47,7 +47,7 @@ const CardWrapper = ({
|
|||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
showInstallButton && (
|
showInstallButton && (
|
||||||
<div className='hidden absolute bottom-0 group-hover:flex items-center space-x-2 px-4 pt-8 pb-4 w-full bg-gradient-to-tr from-[#f9fafb] to-[rgba(249,250,251,0)] rounded-b-xl'>
|
<div className='hidden absolute bottom-0 group-hover:flex items-center space-x-2 px-4 pt-8 pb-4 w-full bg-gradient-to-tr from-components-panel-on-panel-item-bg to-background-gradient-mask-transparent rounded-b-xl'>
|
||||||
<Button
|
<Button
|
||||||
variant='primary'
|
variant='primary'
|
||||||
className='w-[calc(50%-4px)]'
|
className='w-[calc(50%-4px)]'
|
||||||
|
@ -53,22 +53,22 @@ const SortDropdown = () => {
|
|||||||
>
|
>
|
||||||
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
|
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
|
||||||
<div className='flex items-center px-2 pr-3 h-8 rounded-lg bg-state-base-hover-alt cursor-pointer'>
|
<div className='flex items-center px-2 pr-3 h-8 rounded-lg bg-state-base-hover-alt cursor-pointer'>
|
||||||
<span className='mr-1 system-sm-regular'>
|
<span className='mr-1 system-sm-regular text-text-secondary'>
|
||||||
{t('plugin.marketplace.sortBy')}
|
{t('plugin.marketplace.sortBy')}
|
||||||
</span>
|
</span>
|
||||||
<span className='mr-1 system-sm-medium'>
|
<span className='mr-1 system-sm-medium text-text-primary'>
|
||||||
{selectedOption.text}
|
{selectedOption.text}
|
||||||
</span>
|
</span>
|
||||||
<RiArrowDownSLine className='w-4 h-4 text-text-tertiary' />
|
<RiArrowDownSLine className='w-4 h-4 text-text-tertiary' />
|
||||||
</div>
|
</div>
|
||||||
</PortalToFollowElemTrigger>
|
</PortalToFollowElemTrigger>
|
||||||
<PortalToFollowElemContent>
|
<PortalToFollowElemContent>
|
||||||
<div className='p-1 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg'>
|
<div className='p-1 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur backdrop-blur-sm shadow-lg'>
|
||||||
{
|
{
|
||||||
options.map(option => (
|
options.map(option => (
|
||||||
<div
|
<div
|
||||||
key={`${option.value}-${option.order}`}
|
key={`${option.value}-${option.order}`}
|
||||||
className='flex items-center justify-between px-3 pr-2 h-8 cursor-pointer system-md-regular'
|
className='flex items-center justify-between px-3 pr-2 h-8 cursor-pointer system-md-regular text-text-primary rounded-lg hover:bg-components-panel-on-panel-item-bg-hover'
|
||||||
onClick={() => handleSortChange({ sortBy: option.value, sortOrder: option.order })}
|
onClick={() => handleSortChange({ sortBy: option.value, sortOrder: option.order })}
|
||||||
>
|
>
|
||||||
{option.text}
|
{option.text}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
import React, { useMemo, useState } from 'react'
|
import React, { useEffect, useMemo, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useBoolean } from 'ahooks'
|
import { useBoolean } from 'ahooks'
|
||||||
import { RiDeleteBinLine, RiEditLine, RiLoginCircleLine } from '@remixicon/react'
|
import copy from 'copy-to-clipboard'
|
||||||
|
import { RiClipboardLine, RiDeleteBinLine, RiEditLine, RiLoginCircleLine } from '@remixicon/react'
|
||||||
import type { EndpointListItem } from '../types'
|
import type { EndpointListItem } from '../types'
|
||||||
import EndpointModal from './endpoint-modal'
|
import EndpointModal from './endpoint-modal'
|
||||||
import { NAME_FIELD } from './utils'
|
import { NAME_FIELD } from './utils'
|
||||||
import { addDefaultValue, toolCredentialToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
|
import { addDefaultValue, toolCredentialToFormSchemas } from '@/app/components/tools/utils/to-form-schema'
|
||||||
|
import { ClipboardCheck } from '@/app/components/base/icons/src/vender/line/files'
|
||||||
import ActionButton from '@/app/components/base/action-button'
|
import ActionButton from '@/app/components/base/action-button'
|
||||||
import CopyBtn from '@/app/components/base/copy-btn'
|
|
||||||
import Confirm from '@/app/components/base/confirm'
|
import Confirm from '@/app/components/base/confirm'
|
||||||
import Indicator from '@/app/components/header/indicator'
|
import Indicator from '@/app/components/header/indicator'
|
||||||
import Switch from '@/app/components/base/switch'
|
import Switch from '@/app/components/base/switch'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import {
|
import {
|
||||||
useDeleteEndpoint,
|
useDeleteEndpoint,
|
||||||
useDisableEndpoint,
|
useDisableEndpoint,
|
||||||
@ -111,6 +113,25 @@ const EndpointCard = ({
|
|||||||
state,
|
state,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const [isCopied, setIsCopied] = useState(false)
|
||||||
|
const handleCopy = (value: string) => {
|
||||||
|
copy(value)
|
||||||
|
setIsCopied(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isCopied) {
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
setIsCopied(false)
|
||||||
|
}, 2000)
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [isCopied])
|
||||||
|
|
||||||
|
const CopyIcon = isCopied ? ClipboardCheck : RiClipboardLine
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='p-0.5 bg-background-section-burn rounded-xl'>
|
<div className='p-0.5 bg-background-section-burn rounded-xl'>
|
||||||
<div className='group p-2.5 pl-3 bg-components-panel-on-panel-item-bg rounded-[10px] border-[0.5px] border-components-panel-border'>
|
<div className='group p-2.5 pl-3 bg-components-panel-on-panel-item-bg rounded-[10px] border-[0.5px] border-components-panel-border'>
|
||||||
@ -133,11 +154,11 @@ const EndpointCard = ({
|
|||||||
<div className='shrink-0 w-12 text-text-tertiary system-xs-regular'>{endpoint.method}</div>
|
<div className='shrink-0 w-12 text-text-tertiary system-xs-regular'>{endpoint.method}</div>
|
||||||
<div className='group/item grow flex items-center text-text-secondary system-xs-regular truncate'>
|
<div className='group/item grow flex items-center text-text-secondary system-xs-regular truncate'>
|
||||||
<div title={`${data.url}${endpoint.path}`} className='truncate'>{`${data.url}${endpoint.path}`}</div>
|
<div title={`${data.url}${endpoint.path}`} className='truncate'>{`${data.url}${endpoint.path}`}</div>
|
||||||
<CopyBtn
|
<Tooltip popupContent={t(`common.operation.${isCopied ? 'copied' : 'copy'}`)} position='top'>
|
||||||
className='hidden shrink-0 ml-2 group-hover/item:block'
|
<ActionButton className='hidden shrink-0 ml-2 group-hover/item:flex' onClick={() => handleCopy(`${data.url}${endpoint.path}`)}>
|
||||||
value={`${data.url}${endpoint.path}`}
|
<CopyIcon className='w-3.5 h-3.5 text-text-tertiary' />
|
||||||
isPlain
|
</ActionButton>
|
||||||
/>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
@ -8,7 +8,7 @@ type IPluginListProps = {
|
|||||||
|
|
||||||
const PluginList: FC<IPluginListProps> = ({ pluginList }) => {
|
const PluginList: FC<IPluginListProps> = ({ pluginList }) => {
|
||||||
return (
|
return (
|
||||||
<div className='pb-3 bg-white'>
|
<div className='pb-3'>
|
||||||
<div className='grid grid-cols-2 gap-3'>
|
<div className='grid grid-cols-2 gap-3'>
|
||||||
{pluginList.map(plugin => (
|
{pluginList.map(plugin => (
|
||||||
<PluginItem
|
<PluginItem
|
||||||
|
@ -36,7 +36,7 @@ const ProviderCard: FC<Props> = ({
|
|||||||
const { locale } = useI18N()
|
const { locale } = useI18N()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('group relative p-4 pb-3 border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg hover-bg-components-panel-on-panel-item-bg rounded-xl shadow-xs', className)}>
|
<div className={cn('group relative p-4 pb-3 border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg hover:bg-components-panel-on-panel-item-bg rounded-xl shadow-xs', className)}>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<Icon src={payload.icon} />
|
<Icon src={payload.icon} />
|
||||||
@ -61,7 +61,7 @@ const ProviderCard: FC<Props> = ({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className='hidden group-hover:flex items-center gap-2 absolute bottom-0 left-0 right-0 p-4 pt-8 rounded-xl bg-gradient-to-tr from-[#f9fafb] to-[rgba(249,250,251,0)]'
|
className='hidden group-hover:flex items-center gap-2 absolute bottom-0 left-0 right-0 p-4 pt-8 rounded-xl bg-gradient-to-tr from-components-panel-on-panel-item-bg to-background-gradient-mask-transparent'
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className='grow'
|
className='grow'
|
||||||
|
Loading…
Reference in New Issue
Block a user