mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-04 04:54:36 +00:00
fix: bugs in ui
This commit is contained in:
@@ -66,13 +66,13 @@ export default function PluginConfigPage() {
|
||||
<Tabs defaultValue="installed" className="w-full">
|
||||
<div className='flex flex-row justify-between items-center'>
|
||||
<TabsList className='shadow-md py-5 bg-[#f0f0f0]'>
|
||||
<TabsTrigger value="installed" className="px-6 py-4">已安装</TabsTrigger>
|
||||
<TabsTrigger value="market" className="px-6 py-4">插件市场</TabsTrigger>
|
||||
<TabsTrigger value="installed" className="px-6 py-4 cursor-pointer">已安装</TabsTrigger>
|
||||
<TabsTrigger value="market" className="px-6 py-4 cursor-pointer">插件市场</TabsTrigger>
|
||||
|
||||
</TabsList>
|
||||
|
||||
<div className='flex flex-row justify-end items-center'>
|
||||
<Button variant="default" className='px-6 py-4' onClick={() => {
|
||||
<Button variant="default" className='px-6 py-4 cursor-pointer' onClick={() => {
|
||||
setModalOpen(true);
|
||||
setPluginInstallStatus(PluginInstallStatus.WAIT_INPUT);
|
||||
setInstallError(null);
|
||||
|
||||
@@ -93,8 +93,8 @@ const PluginInstalledComponent = forwardRef<PluginInstalledComponentRef>((props,
|
||||
|
||||
{pluginList.map((vo, index) => {
|
||||
return (
|
||||
<div key={index} onClick={() => handlePluginClick(vo)}>
|
||||
<PluginCardComponent cardVO={vo} />
|
||||
<div key={index}>
|
||||
<PluginCardComponent cardVO={vo} onCardClick={() => handlePluginClick(vo)} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -8,13 +8,16 @@ import { Button } from "@/components/ui/button"
|
||||
|
||||
export default function PluginCardComponent({
|
||||
cardVO,
|
||||
onCardClick,
|
||||
}: {
|
||||
cardVO: PluginCardVO;
|
||||
onCardClick: () => void;
|
||||
}) {
|
||||
const [enabled, setEnabled] = useState(cardVO.enabled);
|
||||
const [switchEnable, setSwitchEnable] = useState(true);
|
||||
|
||||
function handleEnable() {
|
||||
function handleEnable(e: React.MouseEvent) {
|
||||
e.stopPropagation(); // 阻止事件冒泡
|
||||
setSwitchEnable(false);
|
||||
httpClient
|
||||
.togglePlugin(cardVO.author, cardVO.name, !enabled)
|
||||
@@ -29,7 +32,7 @@ export default function PluginCardComponent({
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div className={`${styles.cardContainer}`}>
|
||||
<div className={`${styles.cardContainer}`} onClick={onCardClick}>
|
||||
<div className={styles.contentContainer}>
|
||||
<svg className={styles.pluginIcon} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M8 4C8 2.34315 9.34315 1 11 1C12.6569 1 14 2.34315 14 4C14 4.35064 13.9398 4.68722 13.8293 5H18C18.5523 5 19 5.44772 19 6V10.1707C19.3128 10.0602 19.6494 10 20 10C21.6569 10 23 11.3431 23 13C23 14.6569 21.6569 16 20 16C19.6494 16 19.3128 15.9398 19 15.8293V20C19 20.5523 18.5523 21 18 21H4C3.44772 21 3 20.5523 3 20V6C3 5.44772 3.44772 5 4 5H8.17071C8.06015 4.68722 8 4.35064 8 4Z"></path></svg>
|
||||
|
||||
@@ -66,8 +69,9 @@ export default function PluginCardComponent({
|
||||
<div className={styles.operationContainer}>
|
||||
<div className={styles.operationTop}>
|
||||
<Switch
|
||||
className='cursor-pointer'
|
||||
checked={enabled}
|
||||
onCheckedChange={handleEnable}
|
||||
onClick={(e) => handleEnable(e)}
|
||||
disabled={!switchEnable}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -133,7 +133,7 @@ export default function PluginMarketComponent({
|
||||
/>
|
||||
|
||||
<Select value={`${sortByValue},${sortOrderValue}`} onValueChange={handleSortChange}>
|
||||
<SelectTrigger className="w-[180px] ml-2">
|
||||
<SelectTrigger className="w-[180px] ml-2 cursor-pointer">
|
||||
<SelectValue placeholder="排序方式" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
@@ -147,7 +147,7 @@ export default function PluginMarketComponent({
|
||||
{totalCount > 0 && (
|
||||
<Pagination>
|
||||
<PaginationContent>
|
||||
<PaginationItem>
|
||||
<PaginationItem className='cursor-pointer'>
|
||||
<PaginationPrevious
|
||||
onClick={() => handlePageChange(nowPage - 1)}
|
||||
className={nowPage <= 1 ? 'pointer-events-none opacity-50' : ''}
|
||||
@@ -168,7 +168,7 @@ export default function PluginMarketComponent({
|
||||
return Array.from({ length: endPage - startPage + 1 }, (_, i) => {
|
||||
const pageNum = startPage + i;
|
||||
return (
|
||||
<PaginationItem key={pageNum}>
|
||||
<PaginationItem key={pageNum} className='cursor-pointer'>
|
||||
<PaginationLink
|
||||
isActive={pageNum === nowPage}
|
||||
onClick={() => handlePageChange(pageNum)}
|
||||
@@ -183,7 +183,7 @@ export default function PluginMarketComponent({
|
||||
})()}
|
||||
|
||||
|
||||
<PaginationItem>
|
||||
<PaginationItem className='cursor-pointer'>
|
||||
<PaginationNext
|
||||
onClick={() => handlePageChange(nowPage + 1)}
|
||||
className={nowPage >= Math.ceil(totalCount / pageSize) ? 'pointer-events-none opacity-50' : ''}
|
||||
|
||||
@@ -41,11 +41,19 @@ export default function PluginMarketCardComponent({
|
||||
</div>
|
||||
|
||||
<div className={styles.componentEntryContainer}>
|
||||
<svg className={styles.githubIcon} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12.001 2C6.47598 2 2.00098 6.475 2.00098 12C2.00098 16.425 4.86348 20.1625 8.83848 21.4875C9.33848 21.575 9.52598 21.275 9.52598 21.0125C9.52598 20.775 9.51348 19.9875 9.51348 19.15C7.00098 19.6125 6.35098 18.5375 6.15098 17.975C6.03848 17.6875 5.55098 16.8 5.12598 16.5625C4.77598 16.375 4.27598 15.9125 5.11348 15.9C5.90098 15.8875 6.46348 16.625 6.65098 16.925C7.55098 18.4375 8.98848 18.0125 9.56348 17.75C9.65098 17.1 9.91348 16.6625 10.201 16.4125C7.97598 16.1625 5.65098 15.3 5.65098 11.475C5.65098 10.3875 6.03848 9.4875 6.67598 8.7875C6.57598 8.5375 6.22598 7.5125 6.77598 6.1375C6.77598 6.1375 7.61348 5.875 9.52598 7.1625C10.326 6.9375 11.176 6.825 12.026 6.825C12.876 6.825 13.726 6.9375 14.526 7.1625C16.4385 5.8625 17.276 6.1375 17.276 6.1375C17.826 7.5125 17.476 8.5375 17.376 8.7875C18.0135 9.4875 18.401 10.375 18.401 11.475C18.401 15.3125 16.0635 16.1625 13.8385 16.4125C14.201 16.725 14.5135 17.325 14.5135 18.2625C14.5135 19.6 14.501 20.675 14.501 21.0125C14.501 21.275 14.6885 21.5875 15.1885 21.4875C19.259 20.1133 21.9999 16.2963 22.001 12C22.001 6.475 17.526 2 12.001 2Z"></path></svg>
|
||||
<svg
|
||||
className={styles.githubIcon}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
onClick={() => window.open(cardVO.githubURL, '_blank')}
|
||||
style={{ cursor: 'pointer' }}
|
||||
><path d="M12.001 2C6.47598 2 2.00098 6.475 2.00098 12C2.00098 16.425 4.86348 20.1625 8.83848 21.4875C9.33848 21.575 9.52598 21.275 9.52598 21.0125C9.52598 20.775 9.51348 19.9875 9.51348 19.15C7.00098 19.6125 6.35098 18.5375 6.15098 17.975C6.03848 17.6875 5.55098 16.8 5.12598 16.5625C4.77598 16.375 4.27598 15.9125 5.11348 15.9C5.90098 15.8875 6.46348 16.625 6.65098 16.925C7.55098 18.4375 8.98848 18.0125 9.56348 17.75C9.65098 17.1 9.91348 16.6625 10.201 16.4125C7.97598 16.1625 5.65098 15.3 5.65098 11.475C5.65098 10.3875 6.03848 9.4875 6.67598 8.7875C6.57598 8.5375 6.22598 7.5125 6.77598 6.1375C6.77598 6.1375 7.61348 5.875 9.52598 7.1625C10.326 6.9375 11.176 6.825 12.026 6.825C12.876 6.825 13.726 6.9375 14.526 7.1625C16.4385 5.8625 17.276 6.1375 17.276 6.1375C17.826 7.5125 17.476 8.5375 17.376 8.7875C18.0135 9.4875 18.401 10.375 18.401 11.475C18.401 15.3125 16.0635 16.1625 13.8385 16.4125C14.201 16.725 14.5135 17.325 14.5135 18.2625C14.5135 19.6 14.501 20.675 14.501 21.0125C14.501 21.275 14.6885 21.5875 15.1885 21.4875C19.259 20.1133 21.9999 16.2963 22.001 12C22.001 6.475 17.526 2 12.001 2Z"></path></svg>
|
||||
<Button variant="default" size="sm"
|
||||
onClick={() => {
|
||||
handleInstallClick(cardVO.githubURL);
|
||||
}}
|
||||
className='cursor-pointer'
|
||||
>安装</Button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user