Feature: Implement read write access checking on Project Directory and report any issues in home page (#5676)

* chore: skeleton to detect read write directories and if we have access to notify user

* chore: adding buttont to easily change project directory

* chore: cleaning up home page error bar layout and button

* fix: adding clearer comments

* fix: ugly console debugging but I need to save off progress

* fix: removing project dir check on empty string

* fix: debug progress to save off listProjects once. Still bugged...

* fix: more hard coded debugging to get project loading optimizted

* fix: yarp, we got another one bois

* fix: cleaning up code

* fix: massive bug comment to warn devs about chokidar bugs

* fix: returning error instead of throwing

* fix: cleaning up PR

* fix: fixed loading the projects when the project directory changes

* fix: remove testing code

* fix: only skip directories if you can access the project directory since we don't need to view them

* fix: unit tests, turning off noisey localhost vitest garbage

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* fix: deleted testing state

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
This commit is contained in:
Kevin Nadro
2025-03-24 14:57:01 -05:00
committed by GitHub
parent 65c455ae7c
commit fdeb2b3f49
17 changed files with 207 additions and 51 deletions

View File

@ -86,8 +86,16 @@ function ProjectCard({
>
<Link
data-testid="project-link"
to={`${PATHS.FILE}/${encodeURIComponent(project.default_file)}`}
className="flex flex-col flex-1 !no-underline !text-chalkboard-110 dark:!text-chalkboard-10 group-hover:!hue-rotate-0 min-h-[5em] divide-y divide-primary/40 dark:divide-chalkboard-80 group-hover:!divide-primary"
to={
project.readWriteAccess
? `${PATHS.FILE}/${encodeURIComponent(project.default_file)}`
: ''
}
className={`flex flex-col flex-1 !no-underline !text-chalkboard-110 dark:!text-chalkboard-10 min-h-[5em] divide-y divide-primary/40 dark:divide-chalkboard-80 ${
project.readWriteAccess
? 'group-hover:!divide-primary group-hover:!hue-rotate-0'
: 'cursor-not-allowed'
}`}
>
<div className="h-36 relative overflow-hidden bg-gradient-to-b from-transparent to-primary/10 rounded-t-sm">
{imageUrl && (
@ -116,19 +124,21 @@ function ProjectCard({
{project.name?.replace(FILE_EXT, '')}
</h3>
)}
<span className="px-2 text-chalkboard-60 text-xs">
<span data-testid="project-file-count">{numberOfFiles}</span> file
{numberOfFiles === 1 ? '' : 's'}{' '}
{numberOfFolders > 0 && (
<>
{'/ '}
<span data-testid="project-folder-count">
{numberOfFolders}
</span>{' '}
folder{numberOfFolders === 1 ? '' : 's'}
</>
)}
</span>
{project.readWriteAccess && (
<span className="px-2 text-chalkboard-60 text-xs">
<span data-testid="project-file-count">{numberOfFiles}</span> file
{numberOfFiles === 1 ? '' : 's'}{' '}
{numberOfFolders > 0 && (
<>
{'/ '}
<span data-testid="project-folder-count">
{numberOfFolders}
</span>{' '}
folder{numberOfFolders === 1 ? '' : 's'}
</>
)}
</span>
)}
<span className="px-2 text-chalkboard-60 text-xs">
Edited{' '}
<span data-testid="project-edit-date">
@ -145,6 +155,7 @@ function ProjectCard({
data-edit-buttons-for={project.name?.replace(FILE_EXT, '')}
>
<ActionButton
disabled={!project.readWriteAccess}
Element="button"
iconStart={{
icon: 'sketch',
@ -163,6 +174,7 @@ function ProjectCard({
</Tooltip>
</ActionButton>
<ActionButton
disabled={!project.readWriteAccess}
Element="button"
iconStart={{
icon: 'trash',