Skip to content

Commit

Permalink
[solidjs-pod] Get all repositories from GitHub API#684 (#845)
Browse files Browse the repository at this point in the history
* in progress

* chore: get all repos api

* [Angular - NgRx - SCSS] 440: state & service refactor (#527)

* setup: get branch caught up and ready for work

* feat: refactored repository service and test

* feat: refactor of user service and test

* feat: updated user service spec

* feat: created dashboard store files; updated global state files; renamed RepoState and updated all calls

* attempt to fix issues with service updates; some refactoring and adjusting so app compiles

* feat: added auth user data to auth state; updated nav component to use auth state

* feat: adjusted auth call; fixed user call so home page loads

* moved some user logic; still having reload issues and repo view issues

* feat: got app working again! cleaned out console logs

* rebased and fixed most files

* fix broken tests

* removed unused code

* fix: fix pr comments and most tests

* fix: fixed final broken unit test

* fix: updated test; removed unused code in user effect; new user mapping file

* add todo for refactor improvements; update authUser effect to use different rxjs operation

Co-authored-by: LindaT <[email protected]>

* feat(solidjs) - Create navigation header (#840)

* fix(angular-apollo-tailwind): append protocol if missing from user url (#637)

* fix(angular-apollo-tailwind): append protocol if missing from user url

Refs: #591

* test(angular-apollo-tailwind): update with testcases

Closes: #591

* chore: repo card with story and test (#737)

* chore: repo card with story and test

* fix comments

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore: gist panel UI (#741)

* chore: gist panel UI

* fix coment

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* [solidjs-pod] : Create component for search input and filter sort buttons (#831)

* in progress

* in progress

* in progress, paused for now

* chore: search filter sort component

* fixed comments on icons

* [solidjs-tailwinf] Add user profile card (#830)

* [SolidJS-Tailwind] Implement authentication (#734)

* chore(solidjs): remove example components

* feat(solidjs): add signin page

* refactor(solidjs): improve auth setup

* feat(solidjs): pencil in auth flow

* feat(solidjs): add example github communication

* [Angular - NgRx - SCSS] 440: state & service refactor (#527)

* setup: get branch caught up and ready for work

* feat: refactored repository service and test

* feat: refactor of user service and test

* feat: updated user service spec

* feat: created dashboard store files; updated global state files; renamed RepoState and updated all calls

* attempt to fix issues with service updates; some refactoring and adjusting so app compiles

* feat: added auth user data to auth state; updated nav component to use auth state

* feat: adjusted auth call; fixed user call so home page loads

* moved some user logic; still having reload issues and repo view issues

* feat: got app working again! cleaned out console logs

* rebased and fixed most files

* fix broken tests

* removed unused code

* fix: fix pr comments and most tests

* fix: fixed final broken unit test

* fix: updated test; removed unused code in user effect; new user mapping file

* add todo for refactor improvements; update authUser effect to use different rxjs operation

Co-authored-by: LindaT <[email protected]>

* feat(solidjs) - Create navigation header (#840)

* fix(angular-apollo-tailwind): append protocol if missing from user url (#637)

* fix(angular-apollo-tailwind): append protocol if missing from user url

Refs: #591

* test(angular-apollo-tailwind): update with testcases

Closes: #591

* chore: repo card with story and test (#737)

* chore: repo card with story and test

* fix comments

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore: gist panel UI (#741)

* chore: gist panel UI

* fix coment

* fix coment

Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore(solidjs): remove example components

* fixed comments, clean ups

Co-authored-by: Linda Thompson <[email protected]>
Co-authored-by: LindaT <[email protected]>
Co-authored-by: Daian Scuarissi <[email protected]>
Co-authored-by: Oluwakorede Cole <[email protected]>
Co-authored-by: Jerry Hogan <[email protected]>
Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>

* chore: updated amplify.yml file (#729)

* chore: updated amplify.yml file

* changed pnpm to npm

* chore: workflow added (#745)

* chore: workflow added

* CI setup fixes and testing

* CI setup fixes and testing

* CI setup fixes and testing

* tried everything but doesn't work, i think we have to merge this

* auth token added to header

* ..updates

* ..updates

* auth token added to header

* fix file issues

* CI adjustments

* CI adjustments

Co-authored-by: Linda Thompson <[email protected]>
Co-authored-by: LindaT <[email protected]>
Co-authored-by: Daian Scuarissi <[email protected]>
Co-authored-by: Oluwakorede Cole <[email protected]>
Co-authored-by: Victor Chukwuebuka Umeh <[email protected]>
Co-authored-by: Maarten Bicknese <[email protected]>
  • Loading branch information
7 people authored Nov 17, 2022
1 parent a2b1f66 commit 04d1158
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci-solidjs-tailwind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:

steps:
- uses: actions/checkout@v2
uses: pnpm/[email protected]
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
uses: pnpm/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -45,11 +47,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: pnpm/[email protected]
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
uses: pnpm/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
Expand All @@ -75,11 +79,13 @@ jobs:

steps:
- uses: actions/checkout@v2
uses: pnpm/[email protected]
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
uses: pnpm/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
Expand Down
4 changes: 4 additions & 0 deletions solidjs-tailwind/src/components/Icons/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export { default as TwitterIcon } from './TwitterIcon';
export { default as CaretIcon } from './caret';
export { default as CloseIcon } from './close';
export { default as CorrectIcon } from './correct';
export { default as RepoBookIcon } from './repo-book';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Switch,
Match,
} from 'solid-js';
import { CaretIcon, CloseIcon, CorrectIcon } from '../icons';
import { CaretIcon, CloseIcon, CorrectIcon } from '../Icons';

function clickOutside(el, accessor) {
const onClick = (e) => {
Expand Down
2 changes: 1 addition & 1 deletion solidjs-tailwind/src/components/RepoFilter/FilterText.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Show, splitProps } from 'solid-js';
import { CloseIcon } from '../icons';
import { CloseIcon } from '../Icons';

const modifyFilterTypeText = (filterText = 'test') => {
if (filterText.endsWith('s')) {
Expand Down
2 changes: 1 addition & 1 deletion solidjs-tailwind/src/components/RepoFilter/RepoFilter.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mergeProps, Show } from 'solid-js';
import { RepoBookIcon } from '../icons';
import { RepoBookIcon } from '../Icons';
import { FILTER_TYPE_OPTIONS, SORT_OPTIONS } from './data';
import FilterDropdown from './FilterDropdown';
import FilterText from './FilterText';
Expand Down
1 change: 1 addition & 0 deletions solidjs-tailwind/src/components/icons/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as TwitterIcon } from './TwitterIcon';
export { default as CaretIcon } from './caret';
export { default as CloseIcon } from './close';
export { default as CorrectIcon } from './correct';
Expand Down
25 changes: 25 additions & 0 deletions solidjs-tailwind/src/services/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const FetchApi = ({ url, query, variables, headersOptions }) => {
return new Promise((resolve, reject) => {
fetch(url, {
method: 'POST',
headers: {
...headersOptions,
Accept: 'application/vnd.github+json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query,
variables,
}),
})
.then((res) => res.json())
.then((result) => {
resolve(result);
})
.catch((error) => {
reject(error);
});
});
};

export default FetchApi;
55 changes: 55 additions & 0 deletions solidjs-tailwind/src/services/queries/all-repos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
export const USER_REPOS_QUERY = `
query UserRepos(
$username: String!
$afterCursor: String
$beforeCursor: String
$orderBy: RepositoryOrder
$first: Int
$last: Int
) {
owner: user(login: $username) {
repositories(
first: $first
last: $last
after: $afterCursor
before: $beforeCursor
orderBy: $orderBy
ownerAffiliations: [OWNER]
) {
nodes {
id
name
description
stargazerCount
forkCount
isArchived
isFork
primaryLanguage {
id
color
name
}
languages(first: 10, orderBy: { direction: ASC, field: SIZE }) {
nodes {
color
name
id
}
}
isPrivate
visibility
updatedAt
owner {
login
}
}
pageInfo {
endCursor
startCursor
hasNextPage
hasPreviousPage
}
}
}
}
`;
52 changes: 52 additions & 0 deletions solidjs-tailwind/src/services/user-repos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useAuth } from "../auth";
import FetchApi from "./api";
import { USER_REPOS_QUERY } from "./queries/all-repos";

const getUserRepos = async ({
url
}) => {
const { authStore } = useAuth();
const data = {
url,
query: USER_REPOS_QUERY,
variable: null,
headersOptions: {
authorization: `Bearer ${authStore.token}`,
}
}
const resp = await FetchApi(data);
const nodes = resp?.owner?.repositories?.nodes;
const pageInfo = resp?.owner?.repositories?.pageInfo;

if (!nodes) {
return undefined;
}
const repos = nodes?.reduce((acc, repo) => {
return repo
? [
...acc,
{
id: repo.id,
name: repo.name,
description: repo.description,
stargazerCount: repo.stargazerCount,
forkCount: repo.forkCount,
primaryLanguage: {
name: repo.primaryLanguage?.name,
color: repo.primaryLanguage?.color,
},
visibility: repo.visibility,
updatedAt: repo.updatedAt,
owner: repo.owner,
},
]
: acc;
}, []);

return {
pageInfo,
repos
};
};

export default getUserRepos;

0 comments on commit 04d1158

Please sign in to comment.