Skip to content

Commit

Permalink
Merge pull request #89 from vatsalsinghkv/refact--file-structure
Browse files Browse the repository at this point in the history
feat: gsoc label
  • Loading branch information
vatsalsinghkv authored Dec 3, 2024
2 parents 461c277 + 58e9cc6 commit f4f420f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { SortingTag } from '@/models/SortingTag';

export const BASE_URL = 'https://api.github.com';
export const ISSUE_URL = `${BASE_URL}/search/issues`;
export const DEFAULT_LABELS = ['easy', 'first', 'good'];
export const INITIAL_LABELS = ['easy', 'first', 'good'];
export const QUERIES = ['state:open'].join('+');

export const DEFAULT_LANGUAGE: Language = 'all';
export const DEFAULT_ORDERING: Ordering = 'desc';
export const DEFAULT_LABEL: Label = 'hacktoberfest';
export const DEFAULT_LABEL: Label = 'gsoc';
export const DEFAULT_PAGE = 1;
export const DEFAULT_SORTING_TAG: SortingTag = 'best-match';
export const ISSUE_PER_PAGE = 10;
Expand Down
10 changes: 7 additions & 3 deletions src/lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
DEFAULT_LABELS,
DEFAULT_LABEL,
INITIAL_LABELS,
ISSUE_PER_PAGE,
ISSUE_URL,
QUERIES,
Expand Down Expand Up @@ -142,10 +143,13 @@ export const composeUrl = (
label: Label
) => {
const langQuery = lang && lang !== 'all' ? `+language:${lang}` : '';
const defaultLabelQuery = `+label:${DEFAULT_LABELS.join(',')}`;
const defaultLabelQuery = `+label:${
label === 'none' ? INITIAL_LABELS.join(',') : label
}`;

const labelQuery =
label && label.toLocaleLowerCase() !== 'none'
? `${defaultLabelQuery},${label}`
? `${defaultLabelQuery}`
: defaultLabelQuery;

const searchParams = {
Expand Down
3 changes: 2 additions & 1 deletion src/models/Label.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export let label = [
'none',
'hacktoberfest',
'gsoc',
'good first issue',
'bug',
'enhancement',
'documentation',
'easy fix',
];
] as const;

export const sortedLabels = [...label];

Expand Down

0 comments on commit f4f420f

Please sign in to comment.