Clean unuse code
This commit is contained in:
parent
7dd075dd59
commit
4857b01fdf
3 changed files with 714 additions and 198 deletions
844
client-electron/package-lock.json
generated
844
client-electron/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,58 +0,0 @@
|
|||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import useRecipeDashboard from '@/hooks/recipe-dashboard'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { type MaterialSetting } from '@/models/recipe/schema'
|
||||
import { useShallow } from 'zustand/react/shallow'
|
||||
|
||||
interface MaterialListProps {
|
||||
items: MaterialSetting[]
|
||||
}
|
||||
|
||||
const MaterialList: React.FC<MaterialListProps> = ({ items }) => {
|
||||
const { selectedMaterial, setSelectedMaterial } = useRecipeDashboard(
|
||||
useShallow(state => ({
|
||||
selectedMaterial: state.selectedMaterial,
|
||||
setSelectedMaterial: state.setSelectedMaterial
|
||||
}))
|
||||
)
|
||||
|
||||
return (
|
||||
<ScrollArea className="h-screen">
|
||||
<div className="flex flex-col gap-2 p-4 pt-0">
|
||||
{items.map(item => (
|
||||
<button
|
||||
key={item.id}
|
||||
className={cn(
|
||||
'flex flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent',
|
||||
selectedMaterial === item.id && 'bg-muted'
|
||||
)}
|
||||
onClick={() => setSelectedMaterial(item.id)}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-1">
|
||||
<div className="flex items-center">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="font-semibold">
|
||||
{item.id}: {item.materialName}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-xs font-medium">{`${item.materialId}: ${item.materialName}`}</div>
|
||||
</div>
|
||||
{/* <div className="line-clamp-2 text-xs text-muted-foreground">{item.substring(0, 300)}</div>
|
||||
{item.labels.length ? (
|
||||
<div className="flex items-center gap-2">
|
||||
{item.labels.map(label => (
|
||||
<Badge key={label} variant={getBadgeVariantFromLabel(label)}>
|
||||
{label}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
) : null} */}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
)
|
||||
}
|
||||
|
||||
export default MaterialList
|
||||
|
|
@ -46,16 +46,6 @@ const RecipeList: React.FC<RecipeListProps> = ({ items, currentSelectId, onSelec
|
|||
{item.id}: {item.name || 'No Name'}
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="line-clamp-2 text-xs text-muted-foreground">{item.substring(0, 300)}</div>
|
||||
{item.labels.length ? (
|
||||
<div className="flex items-center gap-2">
|
||||
{item.labels.map(label => (
|
||||
<Badge key={label} variant={getBadgeVariantFromLabel(label)}>
|
||||
{label}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
) : null} */}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue