diff --git a/qwik-graphql-tailwind/src/routes/[owner]/[name]/index.tsx b/qwik-graphql-tailwind/src/routes/[owner]/[name]/index.tsx index 4e8f4a576..d490e57f4 100644 --- a/qwik-graphql-tailwind/src/routes/[owner]/[name]/index.tsx +++ b/qwik-graphql-tailwind/src/routes/[owner]/[name]/index.tsx @@ -7,9 +7,7 @@ import { parseTopics } from './parseTopics'; import { RepoTree } from '~/components/repo-tree'; import { RepoReadMe } from '~/components/repo-read-me'; import { RepoAboutWidget } from '~/components/repo-about'; -import { ISSUES_QUERY } from '~/utils/queries/issues-query'; import { BranchNavigation } from '~/components/branch-navigation'; -import { PULL_REQUEST_QUERY } from '~/utils/queries/pull-request'; import { RepoHeader } from '~/components/repo-header'; export interface SharedState { @@ -48,12 +46,6 @@ export interface SharedState { }; } -interface IssuesPullRequestsQueryParams { - owner: string; - name: string; - first: number; -} - export const RepoContext = createContext('repo-context'); export default component$(() => { @@ -110,7 +102,7 @@ export default component$(() => { useContextProvider(RepoContext, store); return ( -
+
{ - const { executeQuery$ } = useQuery(ISSUES_QUERY); - - const resp = await executeQuery$({ - signal: abortController?.signal, - url: GITHUB_GRAPHQL, - variables: { - owner, - name, - first, - }, - headersOpt: { - Accept: 'application/vnd.github+json', - authorization: `Bearer ${sessionStorage.getItem('token')}`, - }, - }); - - return await resp.json(); -} - -export async function fetchPullRequests( - { owner, name, first }: IssuesPullRequestsQueryParams, - abortController?: AbortController -): Promise { - const { executeQuery$ } = useQuery(PULL_REQUEST_QUERY); - - const resp = await executeQuery$({ - signal: abortController?.signal, - url: GITHUB_GRAPHQL, - variables: { - owner, - name, - first, - }, - headersOpt: { - Accept: 'application/vnd.github+json', - authorization: `Bearer ${sessionStorage.getItem('token')}`, - }, - }); - - return await resp.json(); -} diff --git a/solidjs-tailwind/src/App.jsx b/solidjs-tailwind/src/App.jsx index 2353d0fe9..bc0d5352f 100644 --- a/solidjs-tailwind/src/App.jsx +++ b/solidjs-tailwind/src/App.jsx @@ -6,6 +6,10 @@ import SigninPage from './pages/Signin'; import RedirectPage from './pages/Redirect'; import Profile from './pages/Profile'; import OrgProfile from './pages/OrgProfile'; +import RepoDetails from './pages/RepoDetails'; +// import RepoBlob from './pages/RepoBlob'; +import RepoTree from './pages/RepoTree'; +import { Repo } from './components/Repo'; function App() { return ( @@ -17,6 +21,11 @@ function App() { + + + + {/* */} + diff --git a/solidjs-tailwind/src/components/RepoNavigation/RepoNavigation.jsx b/solidjs-tailwind/src/components/BranchNavigation/BranchNavigation.jsx similarity index 62% rename from solidjs-tailwind/src/components/RepoNavigation/RepoNavigation.jsx rename to solidjs-tailwind/src/components/BranchNavigation/BranchNavigation.jsx index d10c72726..41e09f3c5 100644 --- a/solidjs-tailwind/src/components/RepoNavigation/RepoNavigation.jsx +++ b/solidjs-tailwind/src/components/BranchNavigation/BranchNavigation.jsx @@ -1,41 +1,47 @@ import { For } from 'solid-js'; import { Link } from '@solidjs/router'; import { GitBranchIcon } from '../Icons'; -import styles from './RepoNavigation.module.css'; +import styles from './BranchNavigation.module.css'; +import { useParams } from '@solidjs/router'; +import { useRepo } from '../../contexts/RepoContext'; + +function BranchNavigation() { + const params = useParams(); + const { info } = useRepo(); + + const branch = info().branch || params.branch; -function RepoNavigation(props) { // creates a proper GitHub url path from a repo path const hrefPath = (index) => { - const crumbPath = props.path - .split('/') + const crumbPath = params.path?.split('/') .filter(Boolean) .slice(0, index + 1) .join('/'); - return `/${props.owner}/${props.name}/tree/${props.branch}/${crumbPath}`; + return `/${params.owner}/${params.name}/tree/${branch}/${crumbPath}`; }; return (