-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Provide links for viewing issues and pull requests in GitHub
- Loading branch information
Showing
7 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'gov4git-desktop-app': minor | ||
--- | ||
|
||
Provide context | ||
|
||
- Provide links for viewing issues and pull requests in GitHub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { makeStyles, shorthands } from '@fluentui/react-components' | ||
|
||
export const useIssuesStyles = makeStyles({ | ||
controls: { | ||
display: 'flex', | ||
justifyContent: 'flex-end', | ||
...shorthands.padding(0, '4px', '4px', '4px'), | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
import { Card } from '@fluentui/react-card' | ||
import { useAtomValue } from 'jotai' | ||
import { type FC, useEffect } from 'react' | ||
import { type FC, useMemo } from 'react' | ||
|
||
import { ballotIssuesAtom } from '../state/ballots.js' | ||
import { configAtom } from '../state/config.js' | ||
import { useHeadingsStyles } from '../styles/headings.js' | ||
import { IssueBallot2 } from './IssueBallot2.js' | ||
import { useIssuesStyles } from './Issues.styles.js' | ||
|
||
export const Issues: FC = function Issues() { | ||
const ballots = useAtomValue(ballotIssuesAtom) | ||
const headingStyles = useHeadingsStyles() | ||
const styles = useIssuesStyles() | ||
const config = useAtomValue(configAtom) | ||
|
||
useEffect(() => { | ||
console.log(ballots) | ||
}, [ballots]) | ||
|
||
if (ballots == null) return <></> | ||
if (ballots.length === 0) | ||
return ( | ||
<> | ||
<h1 className={headingStyles.pageHeading}>Prioritize Issues</h1> | ||
<Card> | ||
<p>No open ballots for issues to display at this time.</p> | ||
</Card> | ||
</> | ||
) | ||
const issuesLink = useMemo(() => { | ||
if (config == null) return null | ||
return `${config.project_repo}/issues?q=is:open is:issue label:gov4git:prioritize` | ||
}, [config]) | ||
|
||
return ( | ||
<> | ||
<h1 className={headingStyles.pageHeading}>Prioritize Issues</h1> | ||
{ballots.map((ballot) => { | ||
return <IssueBallot2 key={ballot.identifier} ballot={ballot} /> | ||
})} | ||
|
||
<div className={styles.controls}> | ||
{issuesLink != null && ( | ||
<a href={issuesLink} target="_blank" rel="noreferrer"> | ||
View all issues in GitHub | ||
</a> | ||
)} | ||
</div> | ||
|
||
{(ballots == null || ballots.length === 0) && ( | ||
<Card> | ||
<p>No open ballots for issues to display at this time.</p> | ||
</Card> | ||
)} | ||
{ballots != null && | ||
ballots.map((ballot) => { | ||
return <IssueBallot2 key={ballot.identifier} ballot={ballot} /> | ||
})} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { makeStyles, shorthands } from '@fluentui/react-components' | ||
|
||
export const usePullRequestsStyles = makeStyles({ | ||
controls: { | ||
display: 'flex', | ||
justifyContent: 'flex-end', | ||
...shorthands.padding(0, '4px', '4px', '4px'), | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
import { Card } from '@fluentui/react-card' | ||
import { useAtomValue } from 'jotai' | ||
import type { FC } from 'react' | ||
import { type FC, useMemo } from 'react' | ||
|
||
import { ballotPullRequestsAtom } from '../state/ballots.js' | ||
import { configAtom } from '../state/config.js' | ||
import { useHeadingsStyles } from '../styles/headings.js' | ||
import { IssueBallot2 } from './IssueBallot2.js' | ||
import { usePullRequestsStyles } from './PullRequests.styles.js' | ||
|
||
export const PullRequests: FC = function PullRequests() { | ||
const ballots = useAtomValue(ballotPullRequestsAtom) | ||
const headingStyles = useHeadingsStyles() | ||
if (ballots == null) return <></> | ||
if (ballots.length === 0) | ||
return ( | ||
<> | ||
<h1 className={headingStyles.pageHeading}>Prioritize Pull Requests</h1> | ||
<Card> | ||
<p>No open ballots for pull requests to display at this time.</p> | ||
</Card> | ||
</> | ||
) | ||
const config = useAtomValue(configAtom) | ||
const styles = usePullRequestsStyles() | ||
const issuesLink = useMemo(() => { | ||
if (config == null) return null | ||
return `${config.project_repo}/pulls?q=is:open is:pr label:gov4git:prioritize` | ||
}, [config]) | ||
|
||
return ( | ||
<> | ||
<h1 className={headingStyles.pageHeading}>Prioritize Pull Requests</h1> | ||
{ballots.map((ballot) => { | ||
return <IssueBallot2 key={ballot.identifier} ballot={ballot} /> | ||
})} | ||
<h1 className={headingStyles.pageHeading}>Prioritize Issues</h1> | ||
|
||
<div className={styles.controls}> | ||
{issuesLink != null && ( | ||
<a href={issuesLink} target="_blank" rel="noreferrer"> | ||
View all pull requests in GitHub | ||
</a> | ||
)} | ||
</div> | ||
|
||
{(ballots == null || ballots.length === 0) && ( | ||
<Card> | ||
<p>No open ballots for pull requests to display at this time.</p> | ||
</Card> | ||
)} | ||
{ballots != null && | ||
ballots.map((ballot) => { | ||
return <IssueBallot2 key={ballot.identifier} ballot={ballot} /> | ||
})} | ||
</> | ||
) | ||
} |