Skip to content

Commit

Permalink
Fixes editProject action
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Feb 14, 2024
1 parent 3d86749 commit a9558df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/pages/app/sidebar/projects/ProjectList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import ListHeader from "../ListHeader.svelte";
import { pinned as pinStore } from "../../../../projects/ProjectPin.svelte";
import { ChevronRight16, ChevronDown16 } from "svelte-octicons";
import type { Project } from "../../../../api/types";
export let user: User;
export let editProject;
Expand All @@ -22,7 +23,7 @@
expanded.update((val) => !val);
}
function sort(projects) {
function sort(projects: Project[]): Project[] {
if (projects === null) return [];
try {
projects.sort((a, b) => a.title.localeCompare(b.title));
Expand Down Expand Up @@ -69,7 +70,7 @@
<Link toUrl={projectUrl(project)}>
<ProjectListItem
title={project.title}
onEditClick={project.editAccess
onEditClick={project.edit_access
? () => editProject(project)
: undefined}
/>
Expand Down
9 changes: 3 additions & 6 deletions src/projects/ProjectListItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import { Lock16 } from "svelte-octicons";
import { projectUrl } from "../search/search.js";
import Link from "../router/Link.svelte";
import { Project as ProjectStructure } from "../structure/project";
export let project: Project;
export let editProject: (project: Project) => void;
const onEditClick = () => editProject(project);
console.log("edit_access", project.edit_access);
export let editProject;
</script>

<div class="project-link">
Expand All @@ -35,7 +32,7 @@
<div class="center-self">
<EditButton
title={`Edit ${project.title}`}
on:click={onEditClick}
on:click={() => editProject(new ProjectStructure(project))}
/>
</div>
{/if}
Expand Down

0 comments on commit a9558df

Please sign in to comment.