mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
This PR cleans up the improvedJsonDiff flag. These changes were automatically generated by AI and should be reviewed carefully. Fixes #10483 ## 🧹 AI Flag Cleanup Summary This PR removes the `improvedJsonDiff` feature flag, making the enhanced JSON diffing component the default and only option. The now-unused legacy diff component and all related feature flag logic have been removed to streamline the codebase. ### 🚮 Removed - **Components** - `OldEventDiff` component was removed, along with its helper types and constants. - **Flag Logic** - All conditional rendering based on the `improvedJsonDiff` flag was removed. - The `sort` prop from `EventDiff` was removed as it was only used by the legacy component. - **Configuration** - `improvedJsonDiff` flag definition was removed from `uiConfig.ts`, `experimental.ts`, and `server-dev.ts`. - **Tests** - Mock configuration for `improvedJsonDiff` in tests was removed. ### 🛠 Kept - **Components** - `NewEventDiff` was renamed to `EventDiff` and is now the standard implementation. ### 📝 Why The `improvedJsonDiff` feature flag was marked as completed with its outcome being "kept". This cleanup finalizes the feature rollout by removing the flag and associated legacy code, simplifying the implementation and reducing code complexity. --------- Co-authored-by: unleash-bot <194219037+unleash-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Heartman <thomas@getunleash.io>
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import { Typography, Button, useTheme, useMediaQuery } from '@mui/material';
|
|
import { EventDiff } from 'component/events/EventDiff/EventDiff';
|
|
import {
|
|
fadeInBottomEnter,
|
|
fadeInBottomStartWithoutFixed,
|
|
} from 'themes/themeStyles';
|
|
import AnimateOnMount from 'component/common/AnimateOnMount/AnimateOnMount';
|
|
import { useMemo } from 'react';
|
|
|
|
interface IStaleDataNotification {
|
|
refresh: () => void;
|
|
afterSubmitAction: () => void;
|
|
data: unknown;
|
|
cache: unknown;
|
|
show: boolean;
|
|
}
|
|
|
|
export const StaleDataNotification = ({
|
|
refresh,
|
|
show,
|
|
afterSubmitAction,
|
|
data,
|
|
cache,
|
|
}: IStaleDataNotification) => {
|
|
const theme = useTheme();
|
|
const isExtraSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));
|
|
|
|
const style = useMemo(() => {
|
|
const base = {
|
|
...fadeInBottomStartWithoutFixed,
|
|
padding: `${theme.spacing(3)} ${theme.spacing(4)}`,
|
|
boxShadow: theme.boxShadows.elevated,
|
|
borderRadius: theme.shape.borderRadiusLarge,
|
|
backgroundColor: theme.palette.background.paper,
|
|
maxWidth: theme.spacing(75),
|
|
zIndex: theme.zIndex.mobileStepper,
|
|
};
|
|
if (isExtraSmallScreen) {
|
|
return {
|
|
...base,
|
|
right: 0,
|
|
left: 0,
|
|
bottom: 0,
|
|
borderRadius: 0,
|
|
};
|
|
}
|
|
return base;
|
|
}, [theme, isExtraSmallScreen]);
|
|
|
|
return (
|
|
<AnimateOnMount mounted={show} start={style} enter={fadeInBottomEnter}>
|
|
<Typography variant='h5' sx={{ my: 2, mb: 2 }}>
|
|
Your data is stale
|
|
</Typography>
|
|
<Typography variant='body1' sx={{ my: 2, mb: 3 }}>
|
|
The data you have been working on is stale, would you like to
|
|
refresh your data? This may happen if someone has been making
|
|
changes to the data while you were working.
|
|
</Typography>
|
|
<EventDiff entry={{ preData: cache, data }} />
|
|
<Button
|
|
sx={{ mb: 2 }}
|
|
variant='contained'
|
|
color='primary'
|
|
onClick={() => {
|
|
refresh();
|
|
afterSubmitAction();
|
|
}}
|
|
>
|
|
Refresh data
|
|
</Button>
|
|
</AnimateOnMount>
|
|
);
|
|
};
|