Skip to content
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

Wrap all screens with ControlsProvider and ignore config warnings on Authentication screens #209

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ export const Panel = ({ active, api }: PanelProps) => {
addonUninstalled={addonUninstalled}
setAddonUninstalled={setAddonUninstalled}
>
<RunBuildProvider watchState={{ isRunning, startBuild, stopBuild }}>
<div hidden={!active} style={{ containerType: "size", height: "100%" }}>
{children}
</div>
</RunBuildProvider>
<ControlsProvider>
<RunBuildProvider watchState={{ isRunning, startBuild, stopBuild }}>
<div hidden={!active} style={{ containerType: "size", height: "100%" }}>
{children}
</div>
</RunBuildProvider>
</ControlsProvider>
</UninstallProvider>
</AuthProvider>
</Provider>
Expand Down Expand Up @@ -151,17 +153,15 @@ export const Panel = ({ active, api }: PanelProps) => {

const localBuildIsRightBranch = gitInfo.branch === localBuildProgress?.branch;
return withProviders(
<ControlsProvider>
<VisualTests
dismissBuildError={() => setLocalBuildProgress(undefined)}
isOutdated={!!isOutdated}
localBuildProgress={localBuildIsRightBranch ? localBuildProgress : undefined}
setOutdated={setOutdated}
updateBuildStatus={updateBuildStatus}
projectId={projectId}
gitInfo={gitInfo}
storyId={storyId}
/>
</ControlsProvider>
<VisualTests
dismissBuildError={() => setLocalBuildProgress(undefined)}
isOutdated={!!isOutdated}
localBuildProgress={localBuildIsRightBranch ? localBuildProgress : undefined}
setOutdated={setOutdated}
updateBuildStatus={updateBuildStatus}
projectId={projectId}
gitInfo={gitInfo}
storyId={storyId}
/>
);
};
24 changes: 20 additions & 4 deletions src/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ const InfoSection = styled(Section)(({ theme }) => ({

interface ConfigSectionProps {
hidden?: boolean;
ignoreConfig?: boolean;
ignoreSuggestions?: boolean;
onOpen: (scrollTo?: keyof ConfigInfoPayload["configuration"]) => void;
}

export const ConfigSection = ({ hidden, onOpen }: ConfigSectionProps) => {
export const ConfigSection = ({
hidden,
ignoreConfig,
ignoreSuggestions,
onOpen,
}: ConfigSectionProps) => {
const [configInfo] = useSharedState<ConfigInfoPayload>(CONFIG_INFO);
const problems = Object.keys(configInfo?.problems || {});
const suggestions = Object.keys(configInfo?.suggestions || {});
Expand All @@ -48,7 +55,7 @@ export const ConfigSection = ({ hidden, onOpen }: ConfigSectionProps) => {
</Link>
);

if (problems.length > 0)
if (problems.length > 0 && !ignoreConfig)
return (
<WarningSection hidden={hidden}>
<Bar>
Expand All @@ -62,7 +69,7 @@ export const ConfigSection = ({ hidden, onOpen }: ConfigSectionProps) => {
</WarningSection>
);

if (suggestions.length > 0 && !dismissed)
if (suggestions.length > 0 && !dismissed && !ignoreConfig && !ignoreSuggestions)
return (
<InfoSection hidden={hidden}>
<Bar>
Expand All @@ -84,6 +91,8 @@ export const ConfigSection = ({ hidden, onOpen }: ConfigSectionProps) => {
interface ScreenProps {
children: ReactNode;
footer?: ReactNode;
ignoreConfig?: boolean;
ignoreSuggestions?: boolean;
}

const Container = styled.div({
Expand Down Expand Up @@ -122,6 +131,8 @@ export const Screen = ({
</Col>
</Footer>
),
ignoreConfig = false,
ignoreSuggestions = !footer,
}: ScreenProps) => {
const { configVisible } = useControlsState();
const { toggleConfig } = useControlsDispatch();
Expand All @@ -140,7 +151,12 @@ export const Screen = ({

return (
<Container>
<ConfigSection onOpen={openConfig} hidden={configVisible} />
<ConfigSection
onOpen={openConfig}
hidden={configVisible}
ignoreConfig={ignoreConfig}
ignoreSuggestions={!footer}
/>
<Content hidden={configVisible}>{children}</Content>
<Content hidden={!configVisible}>
<Configuration onClose={() => toggleConfig(false)} />
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Authentication/SetSubdomain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const SetSubdomain = ({ onBack, onSignIn }: SetSubdomainProps) => {
);

return (
<Screen footer={null}>
<Screen footer={null} ignoreConfig>
<Container>
<BackButton onClick={onBack}>
<ChevronLeftIcon color={theme.base === "light" ? "currentColor" : theme.color.medium} />
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Authentication/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Label = styled.span(({ theme }) => ({
export const SignIn = ({ onBack, onSignIn, onSignInWithSSO }: SignInProps) => {
const theme = useTheme();
return (
<Screen footer={null}>
<Screen footer={null} ignoreConfig>
<Container>
{onBack && (
<BackButton onClick={onBack}>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Authentication/Verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const Verify = ({
closeDialogRef.current = closeDialog;

return (
<Screen footer={null}>
<Screen footer={null} ignoreConfig>
<Container>
<BackButton onClick={onBack}>
<ChevronLeftIcon color={theme.base === "light" ? "currentColor" : theme.color.medium} />
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Authentication/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface WelcomeProps {

export const Welcome = ({ onNext, onUninstall }: WelcomeProps) => {
return (
<Screen footer={null}>
<Screen footer={null} ignoreConfig>
<Container>
<Stack>
<div>
Expand Down
Loading