Rename missed state -> status occurrences

This commit is contained in:
Sebastian Martinez
2024-07-15 14:43:15 +02:00
parent 1a5830b54a
commit 1775dd284d
12 changed files with 69 additions and 78 deletions
+13 -13
View File
@@ -31,7 +31,7 @@
export let seedingPolicy: SeedingPolicy;
export let issues: Issue[];
export let project: Project;
export let state: IssueState["status"];
export let status: IssueState["status"];
let loading = false;
let page = 0;
@@ -46,12 +46,12 @@
const api = new HttpdClient(baseUrl);
async function loadIssues(state: IssueState["status"]): Promise<void> {
async function loadIssues(status: IssueState["status"]): Promise<void> {
loading = true;
page += 1;
try {
const response = await api.project.getAllIssues(project.id, {
state,
status,
page,
perPage: ISSUES_PER_PAGE,
});
@@ -70,7 +70,7 @@
};
$: showMoreButton =
!loading && !error && allIssues.length < project.issues[state];
!loading && !error && allIssues.length < project.issues[status];
</script>
<style>
@@ -128,12 +128,12 @@
on:click={toggle}
ariaLabel="filter-dropdown"
title="Filter issues by state">
<div style:color={stateColor[state]}>
<div style:color={stateColor[status]}>
<IconSmall name="issue" />
</div>
{capitalize(state)}
{capitalize(status)}
<div class="dropdown-button-counter">
{project.issues[state]}
{project.issues[status]}
</div>
<IconSmall name={expanded ? "chevron-up" : "chevron-down"} />
</Button>
@@ -147,9 +147,9 @@
resource: "project.issues",
project: project.id,
node: baseUrl,
state: item,
status: item,
}}>
<DropdownListItem selected={item === state}>
<DropdownListItem selected={item === status}>
<div style:color={stateColor[item]}>
<IconSmall name="issue" />
</div>
@@ -158,7 +158,7 @@
{capitalize(item)}
<div
class="dropdown-list-counter"
class:selected={item === state}>
class:selected={item === status}>
{project.issues[item]}
</div>
</div>
@@ -188,9 +188,9 @@
{error} />
{/if}
{#if project.issues[state] === 0}
{#if project.issues[status] === 0}
<div class="placeholder">
<Placeholder iconName="no-issues" caption={`No ${state} issues`} />
<Placeholder iconName="no-issues" caption={`No ${status} issues`} />
</div>
{/if}
@@ -204,7 +204,7 @@
<Button
size="large"
variant="outline"
on:click={() => loadIssues(state)}>
on:click={() => loadIssues(status)}>
More
</Button>
{/if}
+16 -13
View File
@@ -31,7 +31,7 @@
export let seedingPolicy: SeedingPolicy;
export let patches: Patch[];
export let project: Project;
export let state: PatchState["status"];
export let status: PatchState["status"];
let loading = false;
let page = 0;
@@ -46,12 +46,12 @@
const api = new HttpdClient(baseUrl);
async function loadMore(state: PatchState["status"]): Promise<void> {
async function loadMore(status: PatchState["status"]): Promise<void> {
loading = true;
page += 1;
try {
const response = await api.project.getAllPatches(project.id, {
state,
status,
page,
perPage: PATCHES_PER_PAGE,
});
@@ -78,7 +78,7 @@
};
$: showMoreButton =
!loading && !error && allPatches.length < project.patches[state];
!loading && !error && allPatches.length < project.patches[status];
</script>
<style>
@@ -136,12 +136,12 @@
on:click={toggle}
ariaLabel="filter-dropdown"
title="Filter patches by state">
<div style:color={stateColor[state]}>
<div style:color={stateColor[status]}>
<IconSmall name="patch" />
</div>
{capitalize(state)}
{capitalize(status)}
<div class="dropdown-button-counter">
{project.patches[state]}
{project.patches[status]}
</div>
<IconSmall name={expanded ? "chevron-up" : "chevron-down"} />
</Button>
@@ -154,9 +154,9 @@
resource: "project.patches",
project: project.id,
node: baseUrl,
search: `state=${item}`,
search: `status=${item}`,
}}>
<DropdownListItem selected={item === state}>
<DropdownListItem selected={item === status}>
<div style:color={stateColor[item]}>
<IconSmall name="patch" />
</div>
@@ -165,7 +165,7 @@
{capitalize(item)}
<div
class="dropdown-list-counter"
class:selected={item === state}>
class:selected={item === status}>
{project.patches[item]}
</div>
</div>
@@ -195,9 +195,9 @@
{error} />
{/if}
{#if project.patches[state] === 0}
{#if project.patches[status] === 0}
<div class="placeholder">
<Placeholder iconName="no-patches" caption={`No ${state} patches`} />
<Placeholder iconName="no-patches" caption={`No ${status} patches`} />
</div>
{/if}
@@ -210,7 +210,10 @@
{/if}
{#if showMoreButton}
<Button size="large" variant="outline" on:click={() => loadMore(state)}>
<Button
size="large"
variant="outline"
on:click={() => loadMore(status)}>
More
</Button>
{/if}
+17 -17
View File
@@ -51,7 +51,7 @@ interface ProjectIssuesRoute {
resource: "project.issues";
node: BaseUrl;
project: string;
state?: "open" | "closed";
status?: "open" | "closed";
}
interface ProjectIssueRoute {
@@ -163,7 +163,7 @@ export type ProjectLoadedRoute =
seedingPolicy: SeedingPolicy;
project: Project;
issues: Issue[];
state: IssueState["status"];
status: IssueState["status"];
};
}
| {
@@ -173,7 +173,7 @@ export type ProjectLoadedRoute =
seedingPolicy: SeedingPolicy;
project: Project;
patches: Patch[];
state: PatchState["status"];
status: PatchState["status"];
};
}
| {
@@ -309,12 +309,12 @@ async function loadPatchesView(
): Promise<ProjectLoadedRoute> {
const api = new HttpdClient(route.node);
const searchParams = new URLSearchParams(route.search || "");
const state = (searchParams.get("state") as PatchState["status"]) || "open";
const status = (searchParams.get("status") as PatchState["status"]) || "open";
const [project, patches, seedingPolicy] = await Promise.all([
api.project.getById(route.project),
api.project.getAllPatches(route.project, {
state,
status,
page: 0,
perPage: PATCHES_PER_PAGE,
}),
@@ -327,7 +327,7 @@ async function loadPatchesView(
baseUrl: route.node,
seedingPolicy,
patches,
state,
status,
project,
},
};
@@ -337,12 +337,12 @@ async function loadIssuesView(
route: ProjectIssuesRoute,
): Promise<ProjectLoadedRoute> {
const api = new HttpdClient(route.node);
const state = route.state || "open";
const status = route.status || "open";
const [project, issues, seedingPolicy] = await Promise.all([
api.project.getById(route.project),
api.project.getAllIssues(route.project, {
state,
status,
page: 0,
perPage: ISSUES_PER_PAGE,
}),
@@ -355,7 +355,7 @@ async function loadIssuesView(
baseUrl: route.node,
seedingPolicy,
issues,
state,
status,
project,
},
};
@@ -741,18 +741,18 @@ export function resolveProjectRoute(
issue: issueOrAction,
};
} else {
const rawState = new URLSearchParams(sanitizeQueryString(urlSearch)).get(
"state",
const rawStatus = new URLSearchParams(sanitizeQueryString(urlSearch)).get(
"status",
);
let state: "open" | "closed" | undefined;
if (rawState === "open" || rawState === "closed") {
state = rawState;
let status: "open" | "closed" | undefined;
if (rawStatus === "open" || rawStatus === "closed") {
status = rawStatus;
}
return {
resource: "project.issues",
node,
project,
state,
status,
};
}
} else if (content === "patches") {
@@ -861,8 +861,8 @@ export function projectRouteToPath(route: ProjectRoute): string {
} else if (route.resource === "project.issues") {
let url = [...pathSegments, "issues"].join("/");
const searchParams = new URLSearchParams();
if (route.state) {
searchParams.set("state", route.state);
if (route.status) {
searchParams.set("status", route.status);
}
if (searchParams.size > 0) {
url += `?${searchParams}`;