Skip to content

chore(site): migrate a few services to react-query used in the DashboardProvider #9667

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

Merged
merged 21 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix preview
  • Loading branch information
BrunoQuaresma committed Sep 13, 2023
commit ec5777780d1e8d2251c6bed44c0d389488eb0328
2 changes: 2 additions & 0 deletions site/src/components/Dashboard/DashboardProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { appearance } from "api/queries/appearance";

interface Appearance {
config: AppearanceConfig;
isPreview: boolean;
setPreview: (config: AppearanceConfig) => void;
}

Expand Down Expand Up @@ -59,6 +60,7 @@ export const DashboardProvider: FC<PropsWithChildren> = ({ children }) => {
appearance: {
config: configPreview ?? appearanceQuery.data,
setPreview: setConfigPreview,
isPreview: configPreview !== undefined,
},
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ServiceBanner: React.FC = () => {
<ServiceBannerView
message={message}
backgroundColor={background_color}
preview={appearance.preview}
isPreview={appearance.isPreview}
/>
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export const Preview: Story = {
args: {
message: "weeeee",
backgroundColor: "#000000",
preview: true,
isPreview: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { hex } from "color-convert";
export interface ServiceBannerViewProps {
message: string;
backgroundColor: string;
preview: boolean;
isPreview: boolean;
}

export const ServiceBannerView: React.FC<ServiceBannerViewProps> = ({
message,
backgroundColor,
preview,
isPreview,
}) => {
const styles = useStyles();
// We don't want anything funky like an image or a heading in the service
Expand All @@ -34,7 +34,7 @@ export const ServiceBannerView: React.FC<ServiceBannerViewProps> = ({
className={styles.container}
style={{ backgroundColor: backgroundColor }}
>
{preview && <Pill text="Preview" type="info" lightBorder />}
{isPreview && <Pill text="Preview" type="info" lightBorder />}
<div
className={styles.centerContent}
style={{
Expand Down