enzostvs HF Staff commited on
Commit
aad1ebc
·
1 Parent(s): 183ba2b

show settings on existing projec tonly

Browse files
components/editor/header.tsx CHANGED
@@ -64,7 +64,7 @@ export function AppEditorHeader({
64
  mobileTab !== "left-sidebar" ? "max-lg:hidden" : "max-lg:w-full!"
65
  )}
66
  >
67
- {project && <ProjectSettings project={project} />}
68
  <div className="flex items-center justify-end gap-2 max-lg:hidden">
69
  {(project?.commits?.length ?? 0) > 0 && (
70
  <Commits commits={project?.commits} />
 
64
  mobileTab !== "left-sidebar" ? "max-lg:hidden" : "max-lg:w-full!"
65
  )}
66
  >
67
+ <ProjectSettings project={project} />
68
  <div className="flex items-center justify-end gap-2 max-lg:hidden">
69
  {(project?.commits?.length ?? 0) > 0 && (
70
  <Commits commits={project?.commits} />
components/editor/project-settings.tsx CHANGED
@@ -35,12 +35,10 @@ import { Input } from "@/components/ui/input";
35
  import { useQueryClient } from "@tanstack/react-query";
36
  import Loading from "@/components/loading";
37
 
38
- // todo: be able to update the project name (means update the project card data title field) :-)
39
-
40
  export const ProjectSettings = ({
41
  project,
42
  }: {
43
- project: ProjectWithCommits;
44
  }) => {
45
  const queryClient = useQueryClient();
46
  const { repoId, owner } = useParams();
@@ -138,19 +136,23 @@ export const ProjectSettings = ({
138
  <DropdownMenuSeparator />
139
  </>
140
  )}
141
- <DropdownMenuItem onClick={() => setOpen(true)}>
142
- <Edit className="size-3.5" />
143
- Rename the project
144
- </DropdownMenuItem>
145
- <DropdownMenuItem>
146
- <Link
147
- href={`https://huggingface.co/${owner}/${repoId}/settings`}
148
- className="flex items-center gap-1.5"
149
- >
150
- <Settings className="size-3.5" />
151
- Project settings
152
- </Link>
153
- </DropdownMenuItem>
 
 
 
 
154
  <DropdownMenuSub>
155
  <DropdownMenuSubTrigger className="flex items-center justify-start gap-1.5">
156
  <RiContrastFill className="size-3.5" />
 
35
  import { useQueryClient } from "@tanstack/react-query";
36
  import Loading from "@/components/loading";
37
 
 
 
38
  export const ProjectSettings = ({
39
  project,
40
  }: {
41
+ project?: ProjectWithCommits | null;
42
  }) => {
43
  const queryClient = useQueryClient();
44
  const { repoId, owner } = useParams();
 
136
  <DropdownMenuSeparator />
137
  </>
138
  )}
139
+ {project && (
140
+ <>
141
+ <DropdownMenuItem onClick={() => setOpen(true)}>
142
+ <Edit className="size-3.5" />
143
+ Rename the project
144
+ </DropdownMenuItem>
145
+ <DropdownMenuItem>
146
+ <Link
147
+ href={`https://huggingface.co/${owner}/${repoId}/settings`}
148
+ className="flex items-center gap-1.5"
149
+ >
150
+ <Settings className="size-3.5" />
151
+ Project settings
152
+ </Link>
153
+ </DropdownMenuItem>
154
+ </>
155
+ )}
156
  <DropdownMenuSub>
157
  <DropdownMenuSubTrigger className="flex items-center justify-start gap-1.5">
158
  <RiContrastFill className="size-3.5" />