@@ -5,11 +5,14 @@ import React from "react";
55import type { TFunction } from "i18next" ;
66import { ButtonMedium } from "@/components/package/Texts/Button" ;
77import { BodyMedium , BodySmall } from "@/components/package/Texts/Body" ;
8- import { MdArrowForward } from "react-icons/md" ;
8+ import { MdArrowForward , MdOpenInNew } from "react-icons/md" ;
99import { MdInfoOutline } from "react-icons/md" ;
1010import { TitleLarge } from "@/components/package/Texts/Title" ;
1111import { ModuleAttributes } from "@/models/Module" ;
1212import NextLink from "next/link" ;
13+ import { Modules } from "@/util/constants" ;
14+
15+ const GHGI_START_HERE_HIDDEN_KEY = "ghgi-start-here-hidden" ;
1316
1417export function ModuleCard ( {
1518 module,
@@ -43,6 +46,18 @@ export function ModuleCard({
4346 } ;
4447
4548 const { name, author, description, tagline, url, logo, status } = module ;
49+ const isGhgi = module . id === Modules . GHGI . id ;
50+ const [ hideStartHereTag , setHideStartHereTag ] = React . useState ( false ) ;
51+
52+ React . useEffect ( ( ) => {
53+ if ( ! isGhgi ) return ;
54+
55+ const isHidden =
56+ localStorage . getItem ( GHGI_START_HERE_HIDDEN_KEY ) === "true" ;
57+ if ( isHidden ) {
58+ setHideStartHereTag ( true ) ;
59+ }
60+ } , [ isGhgi ] ) ;
4661
4762 const getTranslationInLanguage = (
4863 obj : { [ lng : string ] : string } | undefined ,
@@ -57,6 +72,11 @@ export function ModuleCard({
5772 const resolvedUrl = isExternal ? url : `${ baseUrl } ${ url } ` ;
5873
5974 const handleModuleLaunch = ( e : React . MouseEvent ) => {
75+ if ( isGhgi ) {
76+ setHideStartHereTag ( true ) ;
77+ localStorage . setItem ( GHGI_START_HERE_HIDDEN_KEY , "true" ) ;
78+ }
79+
6080 if ( isExternal ) {
6181 e . preventDefault ( ) ;
6282 window . open ( url , "_blank" , "noopener,noreferrer" ) ;
@@ -84,39 +104,55 @@ export function ModuleCard({
84104 < Card . Body gap = { 2 } flex = "1" >
85105 < VStack w = "full" align = "start" gap = { 2 } >
86106 < HStack justify = "space-between" w = "full" >
87- < HStack gap = { 2 } >
107+ < HStack gap = { 2 } justifyContent = "space-between" >
88108 < Image
89109 src = { logo || "/assets/icon_inverted.svg" }
90110 boxSize = { 8 }
91111 alt = { `${ name } module logo` }
92112 />
113+
93114 { status && status !== "active" && (
94115 < Tag size = "sm" colorPalette = { statusColorMap [ status ] || "gray" } >
95116 { t ( statusLabelMap [ status ] || status ) }
96117 </ Tag >
97118 ) }
98119 </ HStack >
99-
100- < Tooltip
101- content = { getTranslationInLanguage ( description ) }
102- showArrow
103- closeDelay = { 8000 }
104- contentProps = { {
105- bg : "content.secondary" ,
106- color : "background.default" ,
107- borderRadius : "md" ,
108- p : 3 ,
109- maxW : "300px" ,
110- fontSize : "sm" ,
111- } }
112- >
113- < Icon
114- as = { MdInfoOutline }
115- boxSize = { 6 }
116- color = "interactive.control"
117- cursor = "pointer"
118- />
119- </ Tooltip >
120+ < HStack gap = { 2 } justifyContent = "flex-end" >
121+ { isGhgi && ! hideStartHereTag && (
122+ < Tag
123+ size = "sm"
124+ colorPalette = "gray"
125+ p = { 2 }
126+ borderRadius = { "8px" }
127+ bg = "border.neutral"
128+ color = "content.secondary"
129+ fontWeight = "semibold"
130+ textTransform = "uppercase"
131+ >
132+ { t ( "start-here" ) }
133+ </ Tag >
134+ ) }
135+ < Tooltip
136+ content = { getTranslationInLanguage ( description ) }
137+ showArrow
138+ closeDelay = { 8000 }
139+ contentProps = { {
140+ bg : "content.secondary" ,
141+ color : "background.default" ,
142+ borderRadius : "md" ,
143+ p : 3 ,
144+ maxW : "300px" ,
145+ fontSize : "sm" ,
146+ } }
147+ >
148+ < Icon
149+ as = { MdInfoOutline }
150+ boxSize = { 6 }
151+ color = "interactive.control"
152+ cursor = "pointer"
153+ />
154+ </ Tooltip >
155+ </ HStack >
120156 </ HStack >
121157 < Card . Title
122158 mt = { 2 }
@@ -151,11 +187,11 @@ export function ModuleCard({
151187 < NextLink
152188 href = { resolvedUrl }
153189 onClick = { handleModuleLaunch }
154- target = { isExternal ? "_blank" : undefined }
155- rel = { isExternal ? "noopener noreferrer" : undefined }
190+ target = { "_blank" }
191+ rel = { "noopener noreferrer" }
156192 >
157193 < ButtonMedium > { t ( "launch" ) } </ ButtonMedium >
158- < MdArrowForward />
194+ < Icon as = { MdOpenInNew } boxSize = { 5 } />
159195 </ NextLink >
160196 </ Button >
161197 </ Card . Footer >
0 commit comments