diff --git a/src/components/furni-editor/views/FurniEditorEditView.tsx b/src/components/furni-editor/views/FurniEditorEditView.tsx index 5242c0f..aac9554 100644 --- a/src/components/furni-editor/views/FurniEditorEditView.tsx +++ b/src/components/furni-editor/views/FurniEditorEditView.tsx @@ -65,6 +65,31 @@ const Tip: FC<{ field: string }> = ({ field }) => ); }; +const CopyValue: FC<{ value: string | number }> = ({ value }) => +{ + const [ copied, setCopied ] = useState(false); + + const copy = useCallback(() => + { + const text = String(value); + const done = () => { setCopied(true); window.setTimeout(() => setCopied(false), 1000); }; + if(navigator.clipboard?.writeText) navigator.clipboard.writeText(text).then(done).catch(() => done()); + else done(); + }, [ value ]); + + return ( +
+ { String(value) } + { copied ? 'copied!' : 'copy' } +
+ ); +}; + export const FurniEditorEditView: FC = props => { const { item, furniDataEntry, interactions, loading, onUpdate, onDelete, onBack, onUpdateFurnidata, onRevertFurnidata } = props; @@ -217,7 +242,6 @@ export const FurniEditorEditView: FC = props => const inputClass = (field?: string) => `w-full px-3 py-1.5 text-sm leading-normal rounded-lg border border-slate-300 bg-white focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/15 transition${ field && validation[field] ? ' border-red-400 bg-red-50' : '' }`; const labelClass = 'text-[11px] font-medium text-slate-500 mb-1 flex items-center gap-0.5'; - const readonlyClass = 'w-full px-3 py-1.5 text-sm font-mono rounded-lg border border-slate-200 bg-slate-50 text-slate-500 select-all'; return ( @@ -267,19 +291,19 @@ export const FurniEditorEditView: FC = props =>
-
{ form.itemName }
+
-
{ form.publicName }
+
-
{ form.spriteId }
+
-
{ form.type === 's' ? 'Floor (s)' : 'Wall (i)' }
+