1
0
mirror of https://github.com/Unleash/unleash.git synced 2026-01-23 20:06:43 +01:00

feat: trigger the splash screen from new in unleash (#11170)

Add support for triggering the splash screen modal from the new in
Unleash toast
This commit is contained in:
Fredrik Strand Oseberg 2025-12-18 10:50:54 +01:00 committed by GitHub
parent fab340f3dc
commit 3fb69cfe9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 5 deletions

View File

@ -33,13 +33,13 @@ export const newInUnleashItems: NewInUnleashItem[] = [
alt='Release templates preview'
/>
),
appLink: '/release-templates',
appLink: '?splash=release-management-v3',
docsLink: 'https://docs.getunleash.io/reference/release-templates',
filter: {
enterpriseOnly: true,
versionLowerThan: '7.5.0',
},
beta: false,
modal: true,
modal: false,
},
];

View File

@ -7,6 +7,7 @@ import {
type TypographyProps,
} from '@mui/material';
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import NewReleases from '@mui/icons-material/NewReleases';
import Close from '@mui/icons-material/Close';
import { NewInUnleashDialog } from './NewInUnleashDialog.tsx';
@ -96,6 +97,7 @@ const StyledButton = styled('button')(({ theme }) => ({
}));
export const NewInUnleashToast = ({ item }: { item: NewInUnleashItem }) => {
const navigate = useNavigate();
const [seenItems, setSeenItems] = useLocalStorageState(
`new-in-unleash-seen:v2`,
new Set(),
@ -114,6 +116,14 @@ export const NewInUnleashToast = ({ item }: { item: NewInUnleashItem }) => {
return () => clearTimeout(timeout);
}, []);
const handleClick = () => {
if (item.modal === false && item.appLink) {
navigate(item.appLink);
} else {
setModalOpen(true);
}
};
return (
<>
<Snackbar
@ -138,9 +148,7 @@ export const NewInUnleashToast = ({ item }: { item: NewInUnleashItem }) => {
<Typography
className='read-more'
component={StyledButton}
onClick={() => {
setModalOpen(true);
}}
onClick={handleClick}
variant='body2'
fontWeight='bold'
>