-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: DIA-1794: [FE] Implement home page in LSO and LSE #6885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
143 commits
Select commit
Hold shift + click to select a range
86cc448
Adding tailwind (wip)
nick-skriabin b3ed266
Merge branch 'develop' into tailwind
nick-skriabin d220c4e
Adding Tailwind and shadcn UI
nick-skriabin 4aa7085
Fix global styles
nick-skriabin a3ec3d6
setting up storybook
nick-skriabin f84e442
Merge branch 'develop' into tailwind
nick-skriabin 93cb876
Move Tailwind config to UI lib
nick-skriabin 6318bf6
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 0a03083
Tailwind and shadcn cross-repo setup
nick-skriabin 9e063ea
Remove testing code
nick-skriabin 2afc869
Rollback unnecessary changes
nick-skriabin 3572a74
Remove dist changes
nick-skriabin 0707aaf
Fix logo size
nick-skriabin 2fdee5f
Ad root page
nick-skriabin 541336d
Page layout, icons, styles
nick-skriabin c36d263
Create project
nick-skriabin 606568d
Properly set up shadcn components installation, remove dist changes
nick-skriabin 88190aa
Restore dist to develop state
nick-skriabin c705d0c
Remove dist changes
nick-skriabin d27fa52
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 6a5764f
Invite link
nick-skriabin 9ffd009
Remove excess files
nick-skriabin 8dca930
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 01ad5c8
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin ada01ba
More components
nick-skriabin e232d9d
Add folder icon
nick-skriabin 326b498
Home page + new components
nick-skriabin c943cca
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin c9204a3
Update web/apps/labelstudio/src/pages/Settings/GeneralSettings.jsx
nick-skriabin 3d385c4
Add folder icon
nick-skriabin 92d627f
Remove and ignore dist
nick-skriabin fc943a4
Ignore dist
nick-skriabin 3eb160f
fix icon
nick-skriabin 30bff00
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin fcf9963
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 8ea21b4
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 233ec7a
Fix wave
nick-skriabin b599398
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 33a6e93
Remove excess code
nick-skriabin df8ba6e
Restore dist (to many changes)
nick-skriabin 6ad56a3
Setup correct redirect after certain user actions
nick-skriabin 5f148f6
Fix small issues
nick-skriabin a02f66b
Add collectstatic make action
nick-skriabin 7c24fb4
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 1bea08b
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 9d5e25b
Update web/apps/labelstudio/src/components/Menubar/Menubar.jsx
nick-skriabin 07a9bc7
Remove unnecessary files
nick-skriabin 19b9df3
Keeping one location for stories (libs/storybook)
nick-skriabin 87e49c2
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin eb54285
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 4e8fb29
Dist
nick-skriabin 957e89a
Dist
nick-skriabin 3e5f3ef
Add UI icons
nick-skriabin 8b38fa5
Self-close
nick-skriabin 60bff6b
Format file
nick-skriabin 21c2a6c
Ignore shadcn components
nick-skriabin 43f9365
Fix biome + stylelint
nick-skriabin e3813d8
Update stylelint and biome
nick-skriabin dc0360e
Allow unknown functions
nick-skriabin 94ac7ae
Remove excess code
nick-skriabin 16e3146
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 2e791a8
Feature flag
nick-skriabin 451e1ea
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin b0d86e4
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 9f34cc7
Rollback unnecessary changes
nick-skriabin a07ab67
storybook
nick-skriabin 2d045c5
Jest configs to address module import issues (WIP)
nick-skriabin f5de72f
Storybook setup
nick-skriabin 3713d9c
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 8b90b71
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin dd5072a
Fix jest tests
nick-skriabin f4bc82e
Fix formatting
nick-skriabin 6069474
Fix formatting for Blue
nick-skriabin b67c273
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin a1db901
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 5e4ba64
Remove traces
nick-skriabin 6de0538
Fix formatting (blue)
nick-skriabin b41dec7
Fix formatting
nick-skriabin 6a4a8a5
Fix formatting
nick-skriabin be6debb
Add docs references
nick-skriabin 23d5e86
Upgrade to Tailwind 4
nick-skriabin a14a254
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 1cf3c55
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 49005bc
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 7ee5a92
Remove unused
nick-skriabin feeacbd
Use better naming
nick-skriabin bd7c6a1
Update web/apps/labelstudio/src/pages/Home/HomePage.tsx
nick-skriabin 873a346
Use shared heading, add comment for invite link refetch
nick-skriabin 2d396f4
Copy text
nick-skriabin 86230f1
Remove unused
nick-skriabin 56f41c0
Encode params into the query key
nick-skriabin 317a5ab
Fix typo
nick-skriabin 7d08b38
Consistent component naming
nick-skriabin b295608
Merge remote-tracking branch 'origin/develop' into fb-dia-1794/home-page
bmartel 6ac248c
tailwind config must exist at the root of web to be part of assumed p…
bmartel 1dbcf25
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 8a86566
Fix routing
nick-skriabin 786edf7
Merge branch 'develop' into 'fb-dia-1794/home-page'
MihajloHoma 7991e55
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin c157795
Fix blue issue
nick-skriabin 8559727
Fix lint
nick-skriabin 1b19c49
Files lowercase
nick-skriabin 6898ea7
Fix casing
nick-skriabin 9d2fdd8
Rename hack
nick-skriabin cad6eaa
Rename hack 2
nick-skriabin 147b70f
Styled progress
nick-skriabin d97296f
Fix UI regressions
nick-skriabin 9bd1db0
remove the development override for home page FF
bmartel 209ee27
Move styles to css file
nick-skriabin 2c58ae5
Remove postfix
nick-skriabin 0591c02
Fix "Browse Templates"
nick-skriabin 2060b16
Merge branch 'develop' into 'fb-1783/follow-up'
borisheartex 22097dc
Merge branch 'develop' into 'fb-dia-1794/home-page'
MihajloHoma 1251697
Fix dot
nick-skriabin cbfa379
Merge branch 'develop' into fb-1783/follow-up
nick-skriabin a2f146d
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin 50e80a0
Fix footers
nick-skriabin 0a50ee5
Fix heading tags font size
nick-skriabin 2535f04
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin ecf39bb
Merge branch 'fb-1783/follow-up' into fb-dia-1783/tailwind
nick-skriabin d9b990d
Merge branch 'develop' into fb-1783/follow-up
nick-skriabin 8c31840
Merge branch 'fb-1783/follow-up' into fb-dia-1783/tailwind
nick-skriabin b49dddf
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 8184f9d
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin b267fde
Fix info icon in templates
nick-skriabin 955138e
Fix select border
nick-skriabin 64523b1
Fix button
nick-skriabin 981397e
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin d248814
feat: DIA-1783: [FE] Prep work - Tailwind + shadcn cross integration …
nick-skriabin 89bd8b6
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 74f29bd
Fix visuals
nick-skriabin 19f4d9e
Fix breadcrumbs
nick-skriabin e9b1098
Fix UI inconsistencies
nick-skriabin b967ebf
Fix security vulnerabilities
nick-skriabin d3a760f
Update lock file
nick-skriabin d0b617c
Update lock file
nick-skriabin dfcb71f
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin 14830b2
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin b80f650
fix ws resolution
bmartel a26c8c4
fix ajv resolution
bmartel b76efc2
Merge branch 'fb-dia-1783/tailwind' into fb-dia-1794/home-page
nick-skriabin 1c3c00a
Rollback ajv
nick-skriabin 5202bfd
Merge branch 'develop' into fb-dia-1794/home-page
nick-skriabin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% extends 'base.html' %} | ||
{% load i18n %} | ||
{% load static %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
import type { Page } from "../types/Page"; | ||
import { Button } from "@humansignal/shad/components/ui/button"; | ||
import { IconFolder, SimpleCard, Spinner } from "@humansignal/ui"; | ||
import { IconExternal, IconFolderAdd, IconHumanSignal, IconUserAdd } from "@humansignal/icons"; | ||
import { HeidiTips } from "../../components/HeidiTips/HeidiTips"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { useAPI } from "../../providers/ApiProvider"; | ||
import { useState } from "react"; | ||
import { CreateProject } from "../CreateProject/CreateProject"; | ||
import { InviteLink } from "../Organization/PeoplePage/InviteLink"; | ||
import { Heading, Sub } from "@humansignal/typography"; | ||
|
||
const PROJECTS_TO_SHOW = 10; | ||
|
||
const resources = [ | ||
{ | ||
title: "Documentation", | ||
url: "https://labelstud.io/guide/", | ||
}, | ||
{ | ||
title: "API Documentation", | ||
url: "https://api.labelstud.io/api-reference/introduction/getting-started", | ||
}, | ||
{ | ||
title: "Release Notes", | ||
url: "https://labelstud.io/learn/categories/release-notes/", | ||
}, | ||
{ | ||
title: "LabelStud.io Blog", | ||
url: "https://labelstud.io/blog/", | ||
}, | ||
{ | ||
title: "Slack Community", | ||
url: "https://slack.labelstud.io", | ||
}, | ||
]; | ||
|
||
const actions = [ | ||
{ | ||
title: "Create Project", | ||
icon: IconFolderAdd, | ||
type: "createProject", | ||
}, | ||
{ | ||
title: "Invite People", | ||
icon: IconUserAdd, | ||
type: "invitePeople", | ||
}, | ||
] as const; | ||
|
||
type Action = (typeof actions)[number]["type"]; | ||
|
||
export const HomePage: Page = () => { | ||
const api = useAPI(); | ||
const [creationDialogOpen, setCreationDialogOpen] = useState(false); | ||
const [invitationOpen, setInvitationOpen] = useState(false); | ||
const { data, isFetching, isSuccess, isError } = useQuery({ | ||
queryKey: ["projects", { page_size: 10 }], | ||
async queryFn() { | ||
return api.callApi<{ results: APIProject[]; count: number }>("projects", { | ||
params: { page_size: PROJECTS_TO_SHOW }, | ||
}); | ||
}, | ||
}); | ||
|
||
const handleActions = (action: Action) => { | ||
return () => { | ||
switch (action) { | ||
case "createProject": | ||
setCreationDialogOpen(true); | ||
break; | ||
case "invitePeople": | ||
setInvitationOpen(true); | ||
break; | ||
} | ||
}; | ||
}; | ||
|
||
return ( | ||
<main className="p-6"> | ||
<div className="grid grid-cols-[minmax(0,1fr)_450px] gap-6"> | ||
<section className="flex flex-col gap-6"> | ||
<div className="flex flex-col gap-1"> | ||
<Heading size={1}>Welcome 👋</Heading> | ||
<Sub>Let's get you started.</Sub> | ||
</div> | ||
<div className="flex justify-between 2xl:justify-start gap-4"> | ||
{actions.map((action) => { | ||
return ( | ||
<Button | ||
key={action.title} | ||
className="flex-1 2xl:flex-grow-0 text-lsLabelMedium text-lsPrimaryContent [&_svg]:w-6 [&_svg]:h-6" | ||
variant="lsOutline" | ||
onClick={handleActions(action.type)} | ||
> | ||
<action.icon className="text-lsPrimaryIcon" /> | ||
{action.title} | ||
</Button> | ||
); | ||
})} | ||
</div> | ||
|
||
<SimpleCard | ||
title={ | ||
data && data?.count > 0 ? ( | ||
<> | ||
Recent Projects{" "} | ||
<a href="/projects" className="text-lg font-normal hover:underline"> | ||
View All | ||
</a> | ||
</> | ||
) : null | ||
} | ||
> | ||
{isFetching ? ( | ||
<div className="h-64 flex justify-center items-center"> | ||
<Spinner /> | ||
</div> | ||
) : isError ? ( | ||
<div className="h-64 flex justify-center items-center">can't load projects</div> | ||
) : isSuccess && data.results.length === 0 ? ( | ||
<div className="flex flex-col justify-center items-center border border-lsBorderSubtle bg-lsPrimaryEmphasisSubtle rounded-lg h-64"> | ||
<div | ||
className={ | ||
"rounded-full w-12 h-12 flex justify-center items-center bg-lsAccentGrapeSubtle text-lsPrimaryIcon" | ||
} | ||
> | ||
<IconFolder /> | ||
</div> | ||
<Heading size={2}>Create your first project</Heading> | ||
<Sub>Import your data and set up the labeling interface to start annotating</Sub> | ||
<Button className="mt-4" onClick={() => setCreationDialogOpen(true)}> | ||
Create Project | ||
</Button> | ||
</div> | ||
) : isSuccess && data.results.length > 0 ? ( | ||
<div className="flex flex-col gap-1"> | ||
{data.results.map((project) => { | ||
return <ProjectSimpleCard key={project.id} project={project} />; | ||
})} | ||
</div> | ||
) : null} | ||
</SimpleCard> | ||
</section> | ||
<section className="flex flex-col gap-6"> | ||
<HeidiTips collection="projectSettings" /> | ||
<SimpleCard title="Resources" description="Learn, explore and get help"> | ||
<ul> | ||
{resources.map((link) => { | ||
return ( | ||
<li key={link.title}> | ||
<a | ||
href={link.url} | ||
className="py-2 px-1 flex justify-between items-center text-lsNeutralContent" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
{link.title} | ||
<IconExternal className="text-lsPrimaryIcon" /> | ||
</a> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</SimpleCard> | ||
<div className="flex gap-2 items-center"> | ||
<IconHumanSignal /> | ||
<span className="text-lsNeutralContentSubtle">Label Studio Version: Community</span> | ||
</div> | ||
</section> | ||
</div> | ||
{creationDialogOpen && <CreateProject redirect={false} onClose={() => setCreationDialogOpen(false)} />} | ||
<InviteLink opened={invitationOpen} onClosed={() => setInvitationOpen(false)} /> | ||
</main> | ||
); | ||
}; | ||
|
||
HomePage.title = "Home"; | ||
HomePage.path = "/"; | ||
HomePage.exact = true; | ||
|
||
function ProjectSimpleCard({ | ||
project, | ||
}: { | ||
project: APIProject; | ||
}) { | ||
const finished = project.finished_task_number ?? 0; | ||
const total = project.task_number ?? 0; | ||
const progress = (total > 0 ? finished / total : 0) * 100; | ||
const white = "#FFFFFF"; | ||
const color = project.color && project.color !== white ? project.color : "#E1DED5"; | ||
|
||
return ( | ||
<div className=" even:bg-lsNeutralSurface rounded-sm overflow-hidden"> | ||
<div | ||
className="grid grid-cols-[minmax(0,1fr)_150px] p-2 py-3 items-center border-l-[3px]" | ||
style={{ borderLeftColor: color }} | ||
> | ||
<div className="flex flex-col gap-1"> | ||
<a href={`/projects/${project.id}`} className="text-lsNeutralContent"> | ||
{project.title} | ||
</a> | ||
<div className="text-lsNeutralContentSubtler"> | ||
{finished} of {total} Tasks ({total > 0 ? Math.round((finished / total) * 100) : 0}%) | ||
</div> | ||
</div> | ||
<div className="bg-lsNeutralSurface rounded-full overflow-hidden w-full h-2 shadow-lsNeutralBorderSubtle shadow-border-1"> | ||
<div className="bg-lsPositiveSurfaceHover h-full" style={{ maxWidth: `${progress}%` }} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.