Skip to content

Commit

Permalink
migrate: dummy repositories migrate to svelte store (#150)
Browse files Browse the repository at this point in the history
* repositories migrated to store with some problems

* null error fixed
  • Loading branch information
codypharm authored Nov 22, 2023
1 parent b39a66d commit ddd83dc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
70 changes: 37 additions & 33 deletions src/app/dashboard/repository/components/repository.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
import useModelStore, { IModel } from '@/state/modelStore'
import React from 'react'
import { BiLike } from 'react-icons/bi'
import { GoDownload } from 'react-icons/go'

export default function Repository({ repository }) {
export default function Repository() {
const { models } = useModelStore()

return (
<div>
<div className="">
{repository.map((item) => (
<div
key={item.id}
className=" border border-primary_9 flex px-5 mb-5 py-3 items-center rounded-xl h-[170px] min-h-[170px]"
>
<div className="w-[80%] h-full">
<div className=" flex h-[25%] items-start ">
<span className="bg-primary_11 rounded-full text-primary_8 py-1 px-3">
{item.label}
</span>
</div>
<div className="h-[20%]">
<span className="text-lg ">{item.title}</span>

{/* extract the values of the object */}
{models && Object.values(models).map(model => (
<div
key={model.id}
className=" border border-primary_9 flex px-5 mb-5 py-3 items-center rounded-xl h-[170px] min-h-[170px]"
>
<div className="w-[80%] h-full">
<div className=" flex h-[25%] items-start ">
<span className="bg-primary_11 rounded-full text-primary_8 py-1 px-3">
{'Text Generation'}
</span>
</div>
<div className="h-[20%]">
<span className="text-lg ">{model.name}</span>
</div>
<div className="flex items-center h-[40%]">
<p className="text-xs">{model.description} </p>
</div>
<div className=" h-[15%] text-xs text-primary_8 flex gap-4">
<div>
<span>Updated {"12 2023"}</span>
</div>
<div className="flex items-center h-[40%]">
<p className="text-xs">{item.description} </p>
<div className="flex">
<GoDownload />
<span>{'12k'}</span>
</div>
<div className=" h-[15%] text-xs text-primary_8 flex gap-4">
<div>
<span>Updated {item.time}</span>
</div>
<div className="flex">
<GoDownload />
<span>{item.dowloaded}</span>
</div>
<div className="flex">
<BiLike />
<span>{item.likes}</span>
</div>
<div className="flex">
<BiLike />
<span>{'50'}</span>
</div>
</div>

<div className="w-[20%] h-full bg-primary_11 "></div>
</div>
))}
</div>

<div className="w-[20%] h-full bg-primary_11 "></div>
</div>
))}

</div>
)
}
2 changes: 1 addition & 1 deletion src/app/dashboard/repository/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function Page() {

<div className=" w-[85%] h-full ">
<div className="w-full h-[80%] flex flex-col gap-6 overflow-y-scroll">
<Repository repository={repositoryList} />
<Repository />
</div>

<div className="flex h-[20%] justify-center gap-x-3 text-primary_7 items-center ">
Expand Down
4 changes: 2 additions & 2 deletions src/state/modelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { devtools, persist } from 'zustand/middleware'
import { upsert_user } from '@app/explore/upsert_user'
import { Model, TrainingRequest } from '@prisma/client'

type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>
export type IModel = Omit<Omit<Model, 'createdAt'>, 'updatedAt'>

interface Models {
export interface Models {
[modelId: string]: IModel
}

Expand Down

0 comments on commit ddd83dc

Please sign in to comment.