File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ type Props = {
88 href ?: string
99 title ?: string
1010 label ?: string
11+ style ?: React . CSSProperties
1112}
1213
1314export const IconButton : React . FC < Props > = ( props ) => {
@@ -29,6 +30,7 @@ export const IconButton: React.FC<Props> = (props) => {
2930 onMouseDown = { props . on_mouse_down }
3031 title = { props . title }
3132 target = "_blank"
33+ style = { props . style }
3234 rel = "noopener noreferrer"
3335 >
3436 { label_element }
@@ -44,6 +46,7 @@ export const IconButton: React.FC<Props> = (props) => {
4446 onMouseDown = { props . on_mouse_down }
4547 onClick = { props . on_click }
4648 title = { props . title }
49+ style = { props . style }
4750 >
4851 { label_element }
4952 { icon_element }
Original file line number Diff line number Diff line change @@ -58,15 +58,11 @@ export const Tasks: React.FC<Props> = (props) => {
5858 const [ forwarded_timestamp , set_forwarded_timestamp ] = useState <
5959 number | null
6060 > ( null )
61+ const [ copied_timestamp , set_copied_timestamp ] = useState < number | null > ( null )
6162 const prevent_edit_ref = useRef ( false )
6263
6364 use_auto_focus_new_task ( props . tasks , set_editing_timestamp )
6465
65- const structure_signature = useMemo (
66- ( ) => get_structure_signature ( props . tasks ) ,
67- [ props . tasks ]
68- )
69-
7066 const tree = useMemo ( ( ) => add_ids ( props . tasks ) , [ props . tasks ] )
7167
7268 const handle_tree_reorder = ( new_tree : SortableTask [ ] ) => {
@@ -171,6 +167,31 @@ export const Tasks: React.FC<Props> = (props) => {
171167 title = "Use"
172168 />
173169 ) }
170+ { params . task . text && (
171+ < IconButton
172+ codicon_icon = {
173+ copied_timestamp == params . task . created_at
174+ ? 'check'
175+ : 'copy'
176+ }
177+ style = {
178+ copied_timestamp == params . task . created_at
179+ ? { cursor : 'default' }
180+ : undefined
181+ }
182+ on_click = { ( e ) => {
183+ e . stopPropagation ( )
184+ navigator . clipboard . writeText ( params . task . text )
185+ set_copied_timestamp ( params . task . created_at )
186+ setTimeout ( ( ) => {
187+ set_copied_timestamp ( ( prev ) =>
188+ prev === params . task . created_at ? null : prev
189+ )
190+ } , 2000 )
191+ } }
192+ title = "Copy"
193+ />
194+ ) }
174195 < IconButton
175196 codicon_icon = { is_editing ? 'check' : 'edit' }
176197 on_mouse_down = {
You can’t perform that action at this time.
0 commit comments