Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/renderer/services/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,31 @@ export class GitHubAPI {
});
}

async getRepositoryLabels(
owner: string,
repo: string,
): Promise<Array<{ name: string; color: string }>> {
const allLabels: Array<{ name: string; color: string }> = [];
let page = 1;
const perPage = 100;
while (true) {
const { data } = await this.octokit.issues.listLabelsForRepo({
owner,
repo,
per_page: perPage,
page,
});
if (!Array.isArray(data) || data.length === 0) break;
for (const l of data) {
if (!l) continue;
allLabels.push({ name: l.name, color: (l as any).color || "000000" });
}
if (data.length < perPage) break;
page++;
}
return allLabels;
}

async getRepositories(page = 1, perPage = 100): Promise<Repository[]> {
const { data } = await this.octokit.repos.listForAuthenticatedUser({
page,
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/stores/uiStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ interface UIState {
sortBy: SortByType;
selectedAuthors: string[];
selectedStatuses: PRStatusFilter[];
selectedLabels: string[];
labelMode: "OR" | "AND" | "NOT" | "ONLY";
includeNoLabel: boolean;
};

toggleSidebar: () => void;
Expand Down Expand Up @@ -73,6 +76,9 @@ export const useUIStore = create<UIState>()(
sortBy: "updated",
selectedAuthors: [],
selectedStatuses: ["open", "draft"],
selectedLabels: [],
labelMode: "OR",
includeNoLabel: false,
},

toggleSidebar: () =>
Expand Down Expand Up @@ -131,6 +137,9 @@ export const useUIStore = create<UIState>()(
sortBy: "updated",
selectedAuthors: [],
selectedStatuses: ["open", "draft"],
selectedLabels: [],
labelMode: "OR",
includeNoLabel: false,
},
}),
}),
Expand Down
Loading