+ )
+}
+
+const useWorkingState = () => {
+ const [isWorking, setIsWorking] = useState(false)
+ const isWorkingRef = useRef(false)
+ const updateWorking = (value: boolean) => {
+ isWorkingRef.current = value
+ setIsWorking(value)
+ }
+ const beginWorking = () => {
+ if (isWorkingRef.current) {
+ return false
+ }
+
+ updateWorking(true)
+ return true
+ }
+
+ return {
+ isWorking,
+ beginWorking,
+ finishWorking: () => updateWorking(false),
+ setIsWorking: updateWorking
+ }
+}
+
+/**
+ * Footer action bar for previews of local snippets. Requires the snippets API
+ * and snippets list contexts, so it is only rendered when the modal receives a
+ * full snippet object rather than bare title/code/type values.
+ */
+const SnippetPreviewActions: React.FC