* ui: start highlight ui * ui: tag items * ui: connecting highlights to notes api... * Highlight feature refinements (#2948) * ui: move clips player to foss, connect notes api to hl * ui: tune note/hl editing, prevent zoom slider body from jumping around * ui: safe check for tag * ui: fix thumbnail gen * ui: fix thumbnail gen * ui: make player modal wider, add shadow * ui: custom warn barge for clips * ui: swap icon for note event wrapper * ui: rm other, fix cancel * ui: moving around creation modal * ui: bg tint * ui: rm disabled for text btn * ui: fix ownership sorting * ui: close player on bg click * ui: fix query, fix min distance for default range * ui: move hl list header out of list comp * ui: spot list header segmented size * Various improvements in highlights (#2955) * ui: update hl in hlPanel comp * ui: rm debug * ui: fix icons file --------- Co-authored-by: Sudheer Salavadi <connect.uxmaster@gmail.com>
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { Checkbox, Modal, Input } from 'antd';
|
|
|
|
function EditHlModal({
|
|
open,
|
|
onSave,
|
|
onCancel,
|
|
text,
|
|
visible,
|
|
}: {
|
|
open: boolean;
|
|
onSave: (noteText: string, visible: boolean) => any;
|
|
onCancel: () => any;
|
|
text: string;
|
|
visible: boolean;
|
|
}) {
|
|
const [noteText, setNoteText] = React.useState(text);
|
|
const [checkboxVisible, setVisible] = React.useState(visible);
|
|
|
|
React.useEffect(() => {
|
|
setNoteText(text);
|
|
setVisible(visible);
|
|
}, [text, visible])
|
|
|
|
const onEdit = (val: string) => {
|
|
if (val.length > 200) {
|
|
return;
|
|
}
|
|
setNoteText(val);
|
|
};
|
|
if (!open) return null;
|
|
|
|
return (
|
|
<Modal
|
|
title={'Edit Highlight'}
|
|
open={open}
|
|
okText={'Save'}
|
|
width={350}
|
|
centered
|
|
onOk={() => onSave(noteText, visible)}
|
|
onCancel={() => onCancel()}
|
|
>
|
|
<div className={'flex flex-col gap-2'}>
|
|
<Input.TextArea
|
|
placeholder={'Highlight note'}
|
|
onChange={(e) => onEdit(e.target.value)}
|
|
maxLength={200}
|
|
value={noteText}
|
|
/>
|
|
<div>{noteText.length}/200 Characters remaining</div>
|
|
<Checkbox
|
|
checked={checkboxVisible}
|
|
onChange={(e) => setVisible(e.target.checked)}
|
|
>
|
|
Team can see and edit this Highlight.
|
|
</Checkbox>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|
|
|
|
export default EditHlModal;
|