diff --git a/.changeset/dirty-dolls-call.md b/.changeset/dirty-dolls-call.md new file mode 100644 index 0000000..6dad8ca --- /dev/null +++ b/.changeset/dirty-dolls-call.md @@ -0,0 +1,7 @@ +--- +'gov4git-desktop-app': minor +--- + +Provide context + +- Provide links for viewing issues and pull requests in GitHub diff --git a/src/renderer/src/components/IssueBallot2.styles.ts b/src/renderer/src/components/IssueBallot2.styles.ts index 28c8249..3927ffb 100644 --- a/src/renderer/src/components/IssueBallot2.styles.ts +++ b/src/renderer/src/components/IssueBallot2.styles.ts @@ -82,4 +82,7 @@ export const useIssueBallotStyles = makeStyles({ down: { color: gov4GitTokens.colorPaletteRedForeground1, }, + issueLinkArea: { + ...shorthands.padding('8px', 0, 0, 0), + }, }) diff --git a/src/renderer/src/components/IssueBallot2.tsx b/src/renderer/src/components/IssueBallot2.tsx index 4ced519..883e802 100644 --- a/src/renderer/src/components/IssueBallot2.tsx +++ b/src/renderer/src/components/IssueBallot2.tsx @@ -28,6 +28,7 @@ import { useCatchError } from '../hooks/useCatchError.js' import { eventBus } from '../lib/eventBus.js' import { formatDecimal } from '../lib/index.js' import { ballotService } from '../services/index.js' +import { configAtom } from '../state/config.js' import { userAtom } from '../state/user.js' import { useButtonStyles } from '../styles/buttons.js' import { useIssueBallotStyles } from './IssueBallot2.styles.js' @@ -50,6 +51,7 @@ export const IssueBallot2: FC = function IssueBallot2({ const buttonStyles = useButtonStyles() const [dialogOpen, setDialogOpen] = useState(false) const user = useAtomValue(userAtom) + const config = useAtomValue(configAtom) const [fetchingNewBallot, setFetchingNewBallot] = useState(false) const [voteError, setVoteError] = useState(null) @@ -64,6 +66,11 @@ export const IssueBallot2: FC = function IssueBallot2({ ) }, [setFetchingNewBallot, ballot]) + const githubLink = useMemo(() => { + if (config == null) return null + const linkComponent = ballot.identifier.split('/').slice(1).join('/') + return `${config.project_repo}/${linkComponent}` + }, [config, ballot]) const maxScore = useMemo(() => { if (user == null) return 0 return ( @@ -315,6 +322,13 @@ export const IssueBallot2: FC = function IssueBallot2({ }), }} > + {githubLink != null && ( +
+ + View in GitHub + +
+ )} {/* {user?.is_maintainer && (
diff --git a/src/renderer/src/components/Issues.styles.ts b/src/renderer/src/components/Issues.styles.ts new file mode 100644 index 0000000..b2e7c46 --- /dev/null +++ b/src/renderer/src/components/Issues.styles.ts @@ -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'), + }, +}) diff --git a/src/renderer/src/components/Issues.tsx b/src/renderer/src/components/Issues.tsx index 3f90584..021c165 100644 --- a/src/renderer/src/components/Issues.tsx +++ b/src/renderer/src/components/Issues.tsx @@ -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 ( - <> -

Prioritize Issues

- -

No open ballots for issues to display at this time.

-
- - ) + const issuesLink = useMemo(() => { + if (config == null) return null + return `${config.project_repo}/issues?q=is:open is:issue label:gov4git:prioritize` + }, [config]) return ( <>

Prioritize Issues

- {ballots.map((ballot) => { - return - })} + +
+ {issuesLink != null && ( + + View all issues in GitHub + + )} +
+ + {(ballots == null || ballots.length === 0) && ( + +

No open ballots for issues to display at this time.

+
+ )} + {ballots != null && + ballots.map((ballot) => { + return + })} ) } diff --git a/src/renderer/src/components/PullRequests.styles.ts b/src/renderer/src/components/PullRequests.styles.ts new file mode 100644 index 0000000..aa234da --- /dev/null +++ b/src/renderer/src/components/PullRequests.styles.ts @@ -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'), + }, +}) diff --git a/src/renderer/src/components/PullRequests.tsx b/src/renderer/src/components/PullRequests.tsx index 36422ca..0ddd274 100644 --- a/src/renderer/src/components/PullRequests.tsx +++ b/src/renderer/src/components/PullRequests.tsx @@ -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 ( - <> -

Prioritize Pull Requests

- -

No open ballots for pull requests to display at this time.

-
- - ) + 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 ( <> -

Prioritize Pull Requests

- {ballots.map((ballot) => { - return - })} +

Prioritize Issues

+ +
+ {issuesLink != null && ( + + View all pull requests in GitHub + + )} +
+ + {(ballots == null || ballots.length === 0) && ( + +

No open ballots for pull requests to display at this time.

+
+ )} + {ballots != null && + ballots.map((ballot) => { + return + })} ) }