File tree Expand file tree Collapse file tree 4 files changed +100
-1
lines changed
Expand file tree Collapse file tree 4 files changed +100
-1
lines changed Original file line number Diff line number Diff line change 1- import { draftMode } from 'next/headers' ;
21import { Metadata } from 'next' ;
32import { ViewTransitions } from 'next-view-transitions' ;
43import { Inter } from 'next/font/google' ;
4+ import { draftMode } from 'next/headers' ;
55import React from 'react' ;
66
77import { DraftModeBanner } from '@/components/draft-mode-banner' ;
88import { Footer } from '@/components/footer' ;
99import { Navbar } from '@/components/navbar' ;
10+ import { AIToast } from '@/components/toast' ;
1011import { CartProvider } from '@/context/cart-context' ;
1112import { generateMetadataObject } from '@/lib/shared/metadata' ;
1213import fetchContentType from '@/lib/strapi/fetchContentType' ;
@@ -66,6 +67,7 @@ export default async function LocaleLayout(props: {
6667 < Navbar data = { pageData . navbar } locale = { locale } />
6768 { children }
6869 < Footer data = { pageData . footer } locale = { locale } />
70+ < AIToast />
6971 { isDraftMode && < DraftModeBanner /> }
7072 </ div >
7173 </ CartProvider >
Original file line number Diff line number Diff line change 1+ import type { ComponentPropsWithoutRef } from 'react' ;
2+
3+ export const ExternalLinkIcon = ( props : ComponentPropsWithoutRef < 'svg' > ) => (
4+ < svg
5+ xmlns = "http://www.w3.org/2000/svg"
6+ width = "24"
7+ height = "24"
8+ viewBox = "0 0 24 24"
9+ fill = "none"
10+ stroke = "currentColor"
11+ strokeWidth = "2"
12+ strokeLinecap = "round"
13+ strokeLinejoin = "round"
14+ { ...props }
15+ >
16+ < path d = "M15 3h6v6" />
17+ < path d = "M10 14 21 3" />
18+ < path d = "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
19+ </ svg >
20+ ) ;
Original file line number Diff line number Diff line change 1+ import type { ComponentPropsWithoutRef } from 'react' ;
2+
3+ export const XIcon = ( props : ComponentPropsWithoutRef < 'svg' > ) => (
4+ < svg
5+ xmlns = "http://www.w3.org/2000/svg"
6+ width = "24"
7+ height = "24"
8+ viewBox = "0 0 24 24"
9+ fill = "none"
10+ stroke = "currentColor"
11+ strokeWidth = "2"
12+ strokeLinecap = "round"
13+ strokeLinejoin = "round"
14+ { ...props }
15+ >
16+ < path d = "M18 6 6 18" />
17+ < path d = "m6 6 12 12" />
18+ </ svg >
19+ ) ;
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+
3+ import clsx from 'clsx' ;
4+ import { useEffect , useState } from 'react' ;
5+
6+ import { ExternalLinkIcon } from '@/components/icons/external-link' ;
7+ import { XIcon } from '@/components/icons/x' ;
8+
9+ export const AIToast = ( ) => {
10+ const [ isOpen , setIsOpen ] = useState ( false ) ;
11+
12+ useEffect ( ( ) => {
13+ setTimeout ( ( ) => {
14+ setIsOpen ( true ) ;
15+ } , 2000 ) ;
16+ } , [ ] ) ;
17+
18+ return (
19+ < div
20+ className = { clsx (
21+ 'fixed bottom-4 left-4 z-50 bg-secondary text-black px-6 py-3 rounded-lg shadow-lg flex items-center gap-4 opacity-0 transition-all' ,
22+ isOpen && 'opacity-100'
23+ ) }
24+ >
25+ < div className = "flex items-start" >
26+ < div className = "flex-1" >
27+ < p className = "text-sm font-medium text-gray-900" > Strapi AI</ p >
28+ < p className = "mt-1 text-sm text-gray-500" >
29+ You can now try Strapi AI for yourself!
30+ </ p >
31+ < div className = "mt-3" >
32+ < a
33+ href = {
34+ 'https://docs.strapi.io/cms/configurations/admin-panel#strapi-ai'
35+ }
36+ target = "_blank"
37+ rel = "noopener noreferrer"
38+ className = "inline-flex items-center gap-1.5 text-sm font-medium text-gray-900 hover:text-gray-700 transition-colors"
39+ >
40+ Go to docs
41+ < ExternalLinkIcon className = "h-3.5 w-3.5" />
42+ </ a >
43+ </ div >
44+ </ div >
45+ < div className = "ml-4 flex flex-shrink-0" >
46+ < button
47+ type = "button"
48+ onClick = { ( ) => setIsOpen ( false ) }
49+ className = "inline-flex rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors"
50+ >
51+ < span className = "sr-only" > Close</ span >
52+ < XIcon className = "h-5 w-5" />
53+ </ button >
54+ </ div >
55+ </ div >
56+ </ div >
57+ ) ;
58+ } ;
You can’t perform that action at this time.
0 commit comments