|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import React, { |
4 | | - FC, |
5 | | - Fragment, |
6 | | - MouseEventHandler, |
7 | | - useCallback, |
8 | | - useEffect, |
9 | | - useMemo, |
10 | | - useState, |
| 4 | + FC, Fragment, MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState |
11 | 5 | } from 'react'; |
12 | 6 | import dayjs from 'dayjs'; |
13 | 7 | import { Integrations } from '@gitroom/frontend/components/launches/calendar.context'; |
@@ -52,6 +46,7 @@ import Image from 'next/image'; |
52 | 46 | import { weightedLength } from '@gitroom/helpers/utils/count.length'; |
53 | 47 | import { uniqBy } from 'lodash'; |
54 | 48 | import { Select } from '@gitroom/react/form/select'; |
| 49 | +import { useClickOutside } from '@gitroom/frontend/components/layout/click.outside'; |
55 | 50 |
|
56 | 51 | function countCharacters(text: string, type: string): number { |
57 | 52 | if (type !== 'x') { |
@@ -411,6 +406,8 @@ export const AddEditModal: FC<{ |
411 | 406 | }); |
412 | 407 | }, [data, postFor, selectedIntegrations]); |
413 | 408 |
|
| 409 | + useClickOutside(askClose); |
| 410 | + |
414 | 411 | return ( |
415 | 412 | <> |
416 | 413 | {user?.tier?.ai && ( |
@@ -465,6 +462,22 @@ export const AddEditModal: FC<{ |
465 | 462 | </Select> |
466 | 463 | )} |
467 | 464 | <DatePicker onChange={setDateState} date={dateState} /> |
| 465 | + {!selectedIntegrations.length && ( |
| 466 | + <svg |
| 467 | + width="10" |
| 468 | + height="11" |
| 469 | + viewBox="0 0 10 11" |
| 470 | + fill="none" |
| 471 | + xmlns="http://www.w3.org/2000/svg" |
| 472 | + className="cursor-pointer" |
| 473 | + onClick={askClose} |
| 474 | + > |
| 475 | + <path |
| 476 | + d="M9.85403 9.64628C9.90048 9.69274 9.93733 9.74789 9.96247 9.80859C9.98762 9.86928 10.0006 9.93434 10.0006 10C10.0006 10.0657 9.98762 10.1308 9.96247 10.1915C9.93733 10.2522 9.90048 10.3073 9.85403 10.3538C9.80757 10.4002 9.75242 10.4371 9.69173 10.4622C9.63103 10.4874 9.56598 10.5003 9.50028 10.5003C9.43458 10.5003 9.36953 10.4874 9.30883 10.4622C9.24813 10.4371 9.19298 10.4002 9.14653 10.3538L5.00028 6.20691L0.854028 10.3538C0.760208 10.4476 0.63296 10.5003 0.500278 10.5003C0.367596 10.5003 0.240348 10.4476 0.146528 10.3538C0.0527077 10.26 2.61548e-09 10.1327 0 10C-2.61548e-09 9.86735 0.0527077 9.7401 0.146528 9.64628L4.2934 5.50003L0.146528 1.35378C0.0527077 1.25996 0 1.13272 0 1.00003C0 0.867352 0.0527077 0.740104 0.146528 0.646284C0.240348 0.552464 0.367596 0.499756 0.500278 0.499756C0.63296 0.499756 0.760208 0.552464 0.854028 0.646284L5.00028 4.79316L9.14653 0.646284C9.24035 0.552464 9.3676 0.499756 9.50028 0.499756C9.63296 0.499756 9.76021 0.552464 9.85403 0.646284C9.94785 0.740104 10.0006 0.867352 10.0006 1.00003C10.0006 1.13272 9.94785 1.25996 9.85403 1.35378L5.70715 5.50003L9.85403 9.64628Z" |
| 477 | + fill="currentColor" |
| 478 | + /> |
| 479 | + </svg> |
| 480 | + )} |
468 | 481 | </div> |
469 | 482 | </TopTitle> |
470 | 483 |
|
@@ -608,9 +621,6 @@ export const AddEditModal: FC<{ |
608 | 621 | id="add-edit-post-dialog-buttons" |
609 | 622 | className="flex flex-row flex-wrap w-full h-full gap-[10px] justify-end items-center" |
610 | 623 | > |
611 | | - <Button className="rounded-[4px]" onClick={askClose}> |
612 | | - Cancel |
613 | | - </Button> |
614 | 624 | <Submitted |
615 | 625 | updateOrder={updateOrder} |
616 | 626 | postId={existingData?.posts?.[0]?.id} |
@@ -690,12 +700,22 @@ export const AddEditModal: FC<{ |
690 | 700 | )} |
691 | 701 | > |
692 | 702 | <div className="mx-[16px]"> |
693 | | - <TopTitle |
694 | | - title="" |
695 | | - expend={expend.show} |
696 | | - collapse={expend.hide} |
697 | | - shouldExpend={expend.expend} |
698 | | - /> |
| 703 | + <TopTitle title=""> |
| 704 | + <svg |
| 705 | + width="10" |
| 706 | + height="11" |
| 707 | + viewBox="0 0 10 11" |
| 708 | + fill="none" |
| 709 | + xmlns="http://www.w3.org/2000/svg" |
| 710 | + className="cursor-pointer" |
| 711 | + onClick={askClose} |
| 712 | + > |
| 713 | + <path |
| 714 | + d="M9.85403 9.64628C9.90048 9.69274 9.93733 9.74789 9.96247 9.80859C9.98762 9.86928 10.0006 9.93434 10.0006 10C10.0006 10.0657 9.98762 10.1308 9.96247 10.1915C9.93733 10.2522 9.90048 10.3073 9.85403 10.3538C9.80757 10.4002 9.75242 10.4371 9.69173 10.4622C9.63103 10.4874 9.56598 10.5003 9.50028 10.5003C9.43458 10.5003 9.36953 10.4874 9.30883 10.4622C9.24813 10.4371 9.19298 10.4002 9.14653 10.3538L5.00028 6.20691L0.854028 10.3538C0.760208 10.4476 0.63296 10.5003 0.500278 10.5003C0.367596 10.5003 0.240348 10.4476 0.146528 10.3538C0.0527077 10.26 2.61548e-09 10.1327 0 10C-2.61548e-09 9.86735 0.0527077 9.7401 0.146528 9.64628L4.2934 5.50003L0.146528 1.35378C0.0527077 1.25996 0 1.13272 0 1.00003C0 0.867352 0.0527077 0.740104 0.146528 0.646284C0.240348 0.552464 0.367596 0.499756 0.500278 0.499756C0.63296 0.499756 0.760208 0.552464 0.854028 0.646284L5.00028 4.79316L9.14653 0.646284C9.24035 0.552464 9.3676 0.499756 9.50028 0.499756C9.63296 0.499756 9.76021 0.552464 9.85403 0.646284C9.94785 0.740104 10.0006 0.867352 10.0006 1.00003C10.0006 1.13272 9.94785 1.25996 9.85403 1.35378L5.70715 5.50003L9.85403 9.64628Z" |
| 715 | + fill="currentColor" |
| 716 | + /> |
| 717 | + </svg> |
| 718 | + </TopTitle> |
699 | 719 | </div> |
700 | 720 | {!!selectedIntegrations.length && ( |
701 | 721 | <div className="flex-1 flex flex-col p-[16px] pt-0"> |
|
0 commit comments