@@ -9,8 +9,10 @@ import {
99 MenuList ,
1010 Spacer ,
1111} from "@chakra-ui/react"
12+ import { PiGlobe } from "@react-icons/all-files/pi/PiGlobe"
13+ import { PiLock } from "@react-icons/all-files/pi/PiLock"
1214import { PiX } from "@react-icons/all-files/pi/PiX"
13- import React from "react"
15+ import React , { useEffect , useState } from "react"
1416import { useTemplateStorage } from "../../context/TemplateStorageContext"
1517import {
1618 type FileElement ,
@@ -60,8 +62,35 @@ export const Header = ({
6062 onViewAllTemplates,
6163} : HeaderProps ) => {
6264 const { imageList, originalImageList, currentImage } = useEditorStore ( )
65+ const templateId = useEditorStore ( ( s ) => s . templateId )
6366 const provider = useTemplateStorage ( )
6467
68+ const [ isPrivate , setIsPrivate ] = useState < boolean | null > ( null )
69+
70+ useEffect ( ( ) => {
71+ let cancelled = false
72+
73+ if ( ! provider || ! templateId ) {
74+ setIsPrivate ( null )
75+ return
76+ }
77+
78+ provider
79+ . getTemplate ( templateId )
80+ . then ( ( record ) => {
81+ if ( cancelled ) return
82+ setIsPrivate ( record ? record . isPrivate : null )
83+ } )
84+ . catch ( ( ) => {
85+ if ( cancelled ) return
86+ setIsPrivate ( null )
87+ } )
88+
89+ return ( ) => {
90+ cancelled = true
91+ }
92+ } , [ provider , templateId ] )
93+
6594 return (
6695 < Flex
6796 as = "header"
@@ -77,6 +106,13 @@ export const Header = ({
77106 >
78107 { provider ? (
79108 < Flex alignItems = "center" gap = "0.5" mr = "3" >
109+ { templateId && (
110+ < Icon
111+ as = { isPrivate === false ? PiGlobe : PiLock }
112+ boxSize = { 5 }
113+ color = "editorBattleshipGrey.500"
114+ />
115+ ) }
80116 < TemplateNameInput />
81117 < TemplatesDropdown onViewAllTemplates = { onViewAllTemplates } />
82118 </ Flex >
0 commit comments