@@ -3,12 +3,15 @@ import { debounce } from "throttle-debounce";
33
44import { createEffectOn } from "../../../hooks/effects" ;
55import { useRefWithUtils } from "../../../hooks/useRefWithUtils" ;
6+ import { showPopup } from "../../../modals/simple-modals-base" ;
67import {
78 Banner as BannerType ,
9+ addBanner ,
810 getBanners ,
911 removeBanner ,
1012} from "../../../states/banners" ;
1113import { setGlobalOffsetTop } from "../../../states/core" ;
14+ import { getSnapshot } from "../../../states/snapshot" ;
1215import { cn } from "../../../utils/cn" ;
1316import { Conditional } from "../../common/Conditional" ;
1417import { Fa } from "../../common/Fa" ;
@@ -78,6 +81,36 @@ function Banner(props: BannerType): JSXElement {
7881export function Banners ( ) : JSXElement {
7982 const [ ref , element ] = useRefWithUtils ( ) ;
8083
84+ let nameChangeAdded = false ;
85+ createEffectOn (
86+ ( ) => getSnapshot ( ) ?. needsToChangeName ,
87+ ( needsToChange ) => {
88+ if ( needsToChange && ! nameChangeAdded ) {
89+ nameChangeAdded = true ;
90+ addBanner ( {
91+ level : "error" ,
92+ icon : "fas fa-exclamation-triangle" ,
93+ customContent : (
94+ < >
95+ You need to update your account name.{ " " }
96+ < button
97+ type = "button"
98+ class = "px-2 py-1"
99+ onClick = { ( ) => {
100+ showPopup ( "updateName" ) ;
101+ } }
102+ >
103+ Click here
104+ </ button > { " " }
105+ to change it and learn more about why.
106+ </ >
107+ ) ,
108+ important : true ,
109+ } ) ;
110+ }
111+ } ,
112+ ) ;
113+
81114 const setGlobalOffsetSignal = ( ) : void => {
82115 const height = element ( ) ?. getOffsetHeight ( ) ?? 0 ;
83116 setGlobalOffsetTop ( height ) ;
0 commit comments