MCPcopy
hub / github.com/bbycroft/llm-viz / WelcomePopup

Function WelcomePopup

src/llm/WelcomePopup.tsx:25–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25export const WelcomePopup: React.FC<{}> = () => {
26 let ctx = useContext(WelcomeContext);
27 useSubscriptions(ctx.subscriptions);
28 let [welcomeState, setWelcomeState] = useLocalStorageState('welcome-popup', hydrateWelcomePopupLS);
29
30 useGlobalKeyboard(KeyboardOrder.Modal, ev => {
31
32 if (ev.key === 'Escape') {
33 hide();
34 }
35
36 ev.stopPropagation();
37 });
38
39 useEffect(() => {
40 if (ctx.forceVisible) {
41 ctx.forceVisible = false;
42 setWelcomeState(a => assignImm(a, { visible: true }));
43 }
44 }, [ctx, setWelcomeState, ctx.forceVisible]);
45
46 function hide() {
47 setWelcomeState(a => assignImm(a, { visible: false }));
48 }
49
50 if (!welcomeState.visible) {
51 return null;
52 }
53
54 return <ModalWindow className={s.modalWindow} backdropClassName={s.modalWindowBackdrop} onBackdropClick={hide}>
55 <div className={s.header}>
56 <div className={s.title}>Welcome!</div>
57 </div>
58 <div className={s.body}>
59 {/* <div className={s.image}>
60 <Image src={IntroImage} alt={"LLM diagram"} />
61 </div> */}
62 <div style={{ width: 600, flex: '0 0 auto' }}>
63 <TocDiagram activePhase={null} onEnterPhase={hide} />
64 </div>
65 <div className={s.text}>
66 <p>This is an interactive 3D Visualization of a Large Language Model (LLM),
67 of the likes that powers GPT-3 & ChatGPT.</p>
68 <p>We show a very small model of the same design, to help you understand how
69 these models work.</p>
70 <p>As well as being interactive, we provide a walkthrough of the model
71 showing the step-by-step process of how it works, with every single add, multiply &
72 math operation described.</p>
73 </div>
74 </div>
75 <div className={s.footer}>
76 <button className={s.button} onClick={hide}>Get Started</button>
77 </div>
78 </ModalWindow>;
79};
80
81class WelcomeManager {
82 subscriptions = new Subscriptions();

Callers

nothing calls this directly

Calls 6

useSubscriptionsFunction · 0.90
useLocalStorageStateFunction · 0.90
useGlobalKeyboardFunction · 0.90
assignImmFunction · 0.90
hideFunction · 0.85
stopPropagationMethod · 0.65

Tested by

no test coverage detected