-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assortment of UI changes for coverage over time for components
- Loading branch information
1 parent
547d4e3
commit f560608
Showing
18 changed files
with
175 additions
and
45 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 |
---|---|---|
|
@@ -57,6 +57,9 @@ const mockPull = { | |
}, | ||
], | ||
}, | ||
head: { | ||
branchName: 'abc', | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
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 |
---|---|---|
|
@@ -40,6 +40,9 @@ export const query = ` | |
message | ||
} | ||
} | ||
head { | ||
branchName | ||
} | ||
} | ||
} | ||
... on NotFoundError { | ||
|
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
7 changes: 5 additions & 2 deletions
7
src/pages/RepoPage/ComponentsTab/BackfillBanners/SyncingBanner/SyncingBanner.tsx
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import { useParams } from 'react-router-dom' | |
import { Branch, useBranch, useBranches } from 'services/branches' | ||
import { useLocationParams } from 'services/navigation' | ||
import { useRepoOverview } from 'services/repo' | ||
import A from 'ui/A' | ||
import Icon from 'ui/Icon' | ||
import Select from 'ui/Select' | ||
|
||
|
@@ -21,7 +22,11 @@ const defaultQueryParams = { | |
const getDecodedBranch = (branch?: string) => | ||
!!branch ? decodeURIComponent(branch) : undefined | ||
|
||
const BranchSelector: React.FC = () => { | ||
interface BranchSelectorProps { | ||
isDisabled: boolean | undefined | ||
} | ||
|
||
const BranchSelector: React.FC<BranchSelectorProps> = ({ isDisabled }) => { | ||
const { provider, owner, repo, branch } = useParams<URLParams>() | ||
const { params, updateParams } = useLocationParams(defaultQueryParams) | ||
const [branchSearchTerm, setBranchSearchTerm] = useState<string>('') | ||
|
@@ -48,7 +53,10 @@ const BranchSelector: React.FC = () => { | |
}) | ||
|
||
const decodedBranch = getDecodedBranch(branch) | ||
const selectedBranch = decodedBranch ?? overview?.defaultBranch ?? '' | ||
|
||
// @ts-expect-error | ||
Check failure on line 57 in src/pages/RepoPage/ComponentsTab/Header/BranchSelector/BranchSelector.tsx GitHub Actions / Run Type Checker
|
||
const selectedBranch = | ||
decodedBranch || params.branch || overview?.defaultBranch || '' | ||
|
||
const { data: searchBranchValue } = useBranch({ | ||
provider, | ||
|
@@ -70,7 +78,7 @@ const BranchSelector: React.FC = () => { | |
} | ||
|
||
return ( | ||
<div className="md:w-[16rem]"> | ||
<div className="flex flex-col justify-between gap-2 p-4 sm:py-0 md:w-[16rem]"> | ||
<h3 className="flex items-center gap-1 text-sm font-semibold text-ds-gray-octonary"> | ||
<span className="text-ds-gray-quinary"> | ||
<Icon name="branch" size="sm" variant="developer" /> | ||
|
@@ -97,8 +105,24 @@ const BranchSelector: React.FC = () => { | |
} | ||
}} | ||
onSearch={(term: string) => setBranchSearchTerm(term)} | ||
disabled={isDisabled} | ||
/> | ||
</span> | ||
{selection?.head?.commitid && ( | ||
<p className="text-xs"> | ||
<span className="font-bold">Source:</span> latest commit{' '} | ||
<A | ||
to={{ | ||
pageName: 'commit', | ||
options: { commit: selection?.head?.commitid }, | ||
}} | ||
isExternal={false} | ||
hook="components-latest-commit" | ||
> | ||
{selection?.head?.commitid.slice(0, 7)} | ||
</A> | ||
</p> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
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
Oops, something went wrong.