-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: git mod - adding init saga and connecting components to ctx #38088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1119f65
2900b65
0d1fa18
146238c
e72e02f
54b5d93
a1b608b
0bb662f
d7e6c79
02e128b
3218b3a
f9c4030
adafd14
488b346
942193d
e9167f2
d024160
ef34582
c3d9a31
fa8c461
9b1414e
2de337e
40f057e
826dbf8
3a47055
ca19474
3a2a045
59f91f4
e1eb35a
3c4a4c2
fbcf6ae
56cbaef
f8545b4
65e9ea6
2b7c3d2
f613ae1
c88bc0b
ea1ab49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import type { GitArtifactType } from "git/constants/enums"; | ||
| import type { FetchGitMetadataResponseData } from "git/requests/fetchGitMetadataRequest.types"; | ||
| import { | ||
| selectGitConnected, | ||
| selectGitMetadata, | ||
| } from "git/store/selectors/gitSingleArtifactSelectors"; | ||
| import type { GitRootState } from "git/store/types"; | ||
| import { useMemo } from "react"; | ||
| import { useSelector } from "react-redux"; | ||
|
|
||
| interface UseGitMetadataParams { | ||
| artifactType: keyof typeof GitArtifactType; | ||
| baseArtifactId: string; | ||
| } | ||
|
|
||
| export interface UseGitMetadataReturnValue { | ||
| gitMetadata: FetchGitMetadataResponseData | null; | ||
| fetchGitMetadataLoading: boolean; | ||
| fetchGitMetadataError: string | null; | ||
| gitConnected: boolean; | ||
| } | ||
|
|
||
| export default function useGitMetadata({ | ||
| artifactType, | ||
| baseArtifactId, | ||
| }: UseGitMetadataParams): UseGitMetadataReturnValue { | ||
| const basePayload = useMemo( | ||
| () => ({ artifactType, baseArtifactId }), | ||
| [artifactType, baseArtifactId], | ||
| ); | ||
|
|
||
| const gitMetadataState = useSelector((state: GitRootState) => | ||
| selectGitMetadata(state, basePayload), | ||
| ); | ||
| const gitConnected = useSelector((state: GitRootState) => | ||
| selectGitConnected(state, basePayload), | ||
| ); | ||
|
|
||
| return { | ||
| gitMetadata: gitMetadataState.value, | ||
| fetchGitMetadataLoading: gitMetadataState.loading ?? false, | ||
| fetchGitMetadataError: gitMetadataState.error, | ||
| gitConnected: gitConnected ?? false, | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,11 @@ const SpinnerContainer = styled.div` | |
| padding: 0 10px; | ||
| `; | ||
|
|
||
| const QuickActionButtonContainer = styled.button<{ disabled?: boolean }>` | ||
| const QuickActionButtonContainer = styled.div<{ disabled?: boolean }>` | ||
| margin: 0 ${(props) => props.theme.spaces[1]}px; | ||
| display: block; | ||
| position: relative; | ||
| overflow: visible; | ||
| cursor: ${({ disabled = false }) => (disabled ? "not-allowed" : "pointer")}; | ||
| opacity: ${({ disabled = false }) => (disabled ? 0.6 : 1)}; | ||
| `; | ||
|
|
||
|
|
@@ -57,11 +56,7 @@ function QuickActionButton({ | |
| const content = capitalizeFirstLetter(tooltipText); | ||
|
|
||
| return ( | ||
| <QuickActionButtonContainer | ||
| className={className} | ||
| disabled={disabled} | ||
| onClick={onClick} | ||
| > | ||
| <QuickActionButtonContainer className={className} disabled={disabled}> | ||
| {loading ? ( | ||
| <SpinnerContainer className="t--loader-quick-git-action"> | ||
| <SpinnerLoader size="md" /> | ||
|
|
@@ -73,6 +68,7 @@ function QuickActionButton({ | |
| isDisabled={disabled} | ||
| isIconButton | ||
| kind="tertiary" | ||
| onClick={onClick} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we give a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with you. However, let's pick it up as an independent task outside of modularisation. Don't want to disturb the CyTests right now as we are working on a tight timeline |
||
| size="md" | ||
| startIcon={icon} | ||
| /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.