Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Display Code of Conduct & License #229

Merged
merged 7 commits into from
Sep 30, 2022
Merged
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ export declare type Repository = {
url: string;
owner: Owner;
primaryLanguage: PrimaryLanguage;
codeOfConduct: CodeOfConduct;
licenseInfo: LicenseInfo;
};

export declare type CodeOfConduct = {
name: string;
};

export declare type LicenseInfo = {
name: string;
};

export declare type Node = {
Expand Down
24 changes: 24 additions & 0 deletions src/lib/components/issue-card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
</div>
</div>
<div class="flex flex-shrink-0">
<div class="hidden flex-shrink-0 xl:flex">
<div class="mt-2 space-y-2">
{#if issue.repository.codeOfConduct}
<Label color="#4267B2" text={issue.repository.codeOfConduct.name} />
{/if}
</div>
<div class="mt-2 space-y-2">
{#if issue.repository.licenseInfo}
<Label color="#4267B2" text={issue.repository.licenseInfo.name} />
{/if}
</div>
</div>
<div class="mr-2 flex items-center px-2">
{#if issue.repository.primaryLanguage}
<Label
Expand Down Expand Up @@ -75,6 +87,18 @@
<Label text={label.node.name} color={label.node.color} />
{/each}
</div>
<div class="flex xl:hidden">
<div class="mt-2 space-y-2">
{#if issue.repository.codeOfConduct}
<Label color="#4267B2" text={issue.repository.codeOfConduct.name} />
{/if}
</div>
<div class="mt-2 space-y-2">
{#if issue.repository.licenseInfo}
<Label color="#4267B2" text={issue.repository.licenseInfo.name} />
{/if}
</div>
</div>
{/if}
</Card>

Expand Down
75 changes: 42 additions & 33 deletions src/routes/api/get-issues/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,54 @@ export const POST: RequestHandler = async ({ request }) => {

const octokit = new Octokit({ auth: token });
const { search }: Response = await octokit.graphql(
`query EddieHubIssues($queryString: String!, $skip: Int!, $after:String) {
search(first: $skip, query: $queryString, type: ISSUE, after: $after) {
issueCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on Issue {
url
title
createdAt
labels(first: $skip) {
edges {
node {
color
name
}
}
}
repository {
`query EddieHubIssues($queryString: String!, $skip: Int!, $after: String) {
search(first: $skip, query: $queryString, type: ISSUE, after: $after) {
issueCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on Issue {
url
title
createdAt
labels(first: $skip) {
edges {
node {
color
name
url
primaryLanguage {
color
name
id
}
owner {
avatarUrl
login
}
}
}
}
repository {
name
url
primaryLanguage {
color
name
id
}
owner {
avatarUrl
login
}
codeOfConduct {
id
name
url
}
licenseInfo {
name
id
}
}
}
}
}`,
}
}
}`,
{
queryString: body.query,
skip: 10,
Expand Down