diff --git a/package.json b/package.json
index 02042fb64..63e97f60f 100644
--- a/package.json
+++ b/package.json
@@ -48,6 +48,7 @@
"@sentry/react": "^7.30.0",
"@tiptap/extension-focus": "^2.0.0-beta.39",
"@tiptap/extension-highlight": "^2.0.0-beta.32",
+ "@tiptap/extension-link": "^2.0.0-beta.209",
"@tiptap/extension-placeholder": "^2.0.0-beta.48",
"@tiptap/react": "^2.0.0-beta.105",
"@tiptap/starter-kit": "^2.0.0-beta.171",
@@ -92,7 +93,7 @@
"react": "^18.2.0",
"react-app-rewired": "^2.1.8",
"react-countdown": "^2.3.2",
- "react-datetime": "^3.1.1",
+ "react-datepicker": "^4.8.0",
"react-device-detect": "^2.1.2",
"react-diff-viewer": "^3.1.1",
"react-dom": "^18.2.0",
diff --git a/src/components/ActionsBuilder/SupportedActions/GenericCall/GenericCallParamsMatcher.tsx b/src/components/ActionsBuilder/SupportedActions/GenericCall/GenericCallParamsMatcher.tsx
index 9cb108993..5113f499f 100644
--- a/src/components/ActionsBuilder/SupportedActions/GenericCall/GenericCallParamsMatcher.tsx
+++ b/src/components/ActionsBuilder/SupportedActions/GenericCall/GenericCallParamsMatcher.tsx
@@ -4,7 +4,7 @@ import { ChildrenNode, Matcher, MatchResponse, Node } from 'interweave';
import moment from 'moment';
import { BlockExplorerLink } from 'components/primitives/Links';
import { FunctionParamWithValue } from 'components/ActionsBuilder/SupportedActions/GenericCall/GenericCallInfoLine';
-import { capitalizeFirstLetter } from 'utils';
+import { getDurationData } from 'hooks/Guilds/useDuration/getDurationData';
interface MatcherOptions {
params: FunctionParamWithValue[];
}
@@ -37,9 +37,9 @@ export const renderGenericCallParamValue = (
return `${moment.unix(Number(param.value)).utc().format('LLLL')} UTC`;
case 'duration':
case 'time':
- return capitalizeFirstLetter(
- moment.duration(Number(param.value), 'seconds').humanize()
- );
+ return param.value === '0'
+ ? '0 seconds'
+ : getDurationData(Number(param.value))?.string;
case 'boolean':
return `${param.value}`;
case 'tokenAmount':
diff --git a/src/components/ActionsBuilder/SupportedActions/GenericCall/__snapshots__/GenericCallParamsMatcher.test.tsx.snap b/src/components/ActionsBuilder/SupportedActions/GenericCall/__snapshots__/GenericCallParamsMatcher.test.tsx.snap
index d06ba6a0a..074586f3f 100644
--- a/src/components/ActionsBuilder/SupportedActions/GenericCall/__snapshots__/GenericCallParamsMatcher.test.tsx.snap
+++ b/src/components/ActionsBuilder/SupportedActions/GenericCall/__snapshots__/GenericCallParamsMatcher.test.tsx.snap
@@ -169,7 +169,7 @@ exports[`GenericCallParamsMatcher Should match snapshot for all component types
exports[`GenericCallParamsMatcher Should match snapshot for all component types 5`] = `
- 52 years
+ 53 years, 2 months, 1 day, 18 hours, 17 minutes and 18 seconds
`;
@@ -399,7 +399,7 @@ exports[`GenericCallParamsMatcher replaces all component types correctly 5`] = `
matchedparam="timeParam"
style="display: inline-block;"
>
- 52 years
+ 53 years, 2 months, 1 day, 18 hours, 17 minutes and 18 seconds
diff --git a/src/components/Editor/useTextEditor.tsx b/src/components/Editor/useTextEditor.tsx
index d23da4105..dc94a89ba 100644
--- a/src/components/Editor/useTextEditor.tsx
+++ b/src/components/Editor/useTextEditor.tsx
@@ -3,6 +3,7 @@ import StarterKit from '@tiptap/starter-kit';
import Focus from '@tiptap/extension-focus';
import Highlight from '@tiptap/extension-highlight';
import Placeholder from '@tiptap/extension-placeholder';
+import Link from '@tiptap/extension-link';
import { Editor } from './components/Editor';
import TurndownService from 'turndown';
import useLocalStorageWithExpiry from 'hooks/Guilds/useLocalStorageWithExpiry';
@@ -44,6 +45,7 @@ export const useTextEditor = (
placeholder,
}),
Highlight,
+ Link,
],
onUpdate: ({ editor }) => {
const html = editor.getHTML();
diff --git a/src/components/ProposalDescription/ProposalDescription.tsx b/src/components/ProposalDescription/ProposalDescription.tsx
index 075e1b50b..dfe0f3711 100644
--- a/src/components/ProposalDescription/ProposalDescription.tsx
+++ b/src/components/ProposalDescription/ProposalDescription.tsx
@@ -21,7 +21,15 @@ export const ProposalDescription: React.FC = ({
return (
{metadata?.description ? (
- {metadata.description}
+
+ {metadata.description}
+
) : (
)}
diff --git a/src/components/primitives/Forms/DateInput/DateInput.tsx b/src/components/primitives/Forms/DateInput/DateInput.tsx
index 66a01d514..94d3bf8fb 100644
--- a/src/components/primitives/Forms/DateInput/DateInput.tsx
+++ b/src/components/primitives/Forms/DateInput/DateInput.tsx
@@ -1,86 +1,77 @@
-import styled from 'styled-components';
-import DateTime from 'react-datetime';
-import { Moment } from 'moment';
-import 'react-datetime/css/react-datetime.css';
+import { createGlobalStyle } from 'styled-components';
+import DatePicker from 'react-datepicker';
+import moment, { Moment } from 'moment';
+import 'react-datepicker/dist/react-datepicker.css';
import { Input, InputProps } from 'components/primitives/Forms/Input';
-import { useMemo } from 'react';
+import { forwardRef } from 'react';
-const StyledDateTime = styled(DateTime)`
- .rdtPicker {
- background: ${({ theme }) => theme.colors.bg3};
- box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.25);
+const GlobalDatePickerStyles = createGlobalStyle`
+ .react-datepicker {
+ background-color: ${({ theme }) => theme.colors.bg3};
+ box-shadow: 0 0 1rem rgba(0, 0, 0, 0.4);
border: 1px solid ${({ theme }) => theme.colors.border1};
- padding: 1.5rem;
border-radius: 0.625rem;
font-family: ${({ theme }) => theme.fonts.body};
- color: ${({ theme }) => theme.colors.grey};
- position: fixed;
+ color: ${({ theme }) => theme.colors.white};
}
-
- .rdtPicker .rdtMonths td,
- .rdtPicker .rdtYears td {
- height: 3.5rem;
+ .react-datepicker__day, .react-datepicker__day-name {
+ color: ${({ theme }) => theme.colors.white};
+ width: 2.5rem;
+ line-height: 2.5rem;
+ }
+ .react-datepicker__header {
+ color: ${({ theme }) => theme.colors.white};
+ background-color: transparent;
+ border-bottom: none;
+ padding-top: 16px;
}
- .rdtPicker .rdtDays td,
- .rdtPicker .rdtDays th,
- .rdtPicker .rdtMonths th,
- .rdtPicker .rdtYears th {
- height: 2.5rem;
- width: 2.5rem;
+ .react-datepicker__navigation--previous {
+ left: 8px;
+ top: 10px;
}
- .rdtPicker td.rdtYear:hover,
- .rdtPicker td.rdtMonth:hover,
- .rdtPicker td.rdtDay:hover,
- .rdtPicker td.rdtHour:hover,
- .rdtPicker td.rdtMinute:hover,
- .rdtPicker td.rdtSecond:hover {
- background: ${({ theme }) => theme.colors.bg4};
- border-radius: 50%;
- outline: 1px solid ${({ theme }) => theme.colors.text};
+ .react-datepicker__navigation--next {
+ right: 8px;
+ top: 8.5px;
}
- .rdtPicker td.rdtTimeToggle:hover,
- .rdtPicker td.rdtSwitch:hover {
- background: ${({ theme }) => theme.colors.bg4};
- cursor: pointer;
+ .react-datepicker__day-names {
+ margin-top: 16px;
+ margin-bottom: -16px;
+ }
+
+ .react-datepicker__day--keyboard-selected {
+ background-color: transparent;
}
- .rdtPicker td.rdtOld,
- .rdtPicker td.rdtNew {
- color: ${({ theme }) => theme.colors.grey};
+ .react-datepicker__current-month, .react-datepicker__day-name {
+ color: ${({ theme }) => theme.colors.white};
}
- .rdtPicker td.rdtToday:before {
- display: none;
+ .react-datepicker__day:hover {
+ background: ${({ theme }) => theme.colors.bg4};
+ border-radius: 50%;
+ outline: 1px solid ${({ theme }) => theme.colors.text};
}
- .rdtPicker td.rdtActive,
- .rdtPicker td.rdtActive:hover {
+ .react-datepicker__day--selected {
border-radius: 50%;
background-color: ${({ theme }) => theme.colors.bg1};
cursor: pointer;
}
- .rdtPicker th {
- border: none;
- }
-
- .rdtPicker th.rdtNext,
- .rdtPicker th.rdtPrev {
- vertical-align: middle;
+ .react-datepicker__day--outside-month {
+ color: ${({ theme }) => theme.colors.grey};
}
- .rdtPicker th.rdtSwitch:hover,
- .rdtPicker th.rdtNext:hover,
- .rdtPicker th.rdtPrev:hover,
- .rdtPicker .rdtCounter .rdtBtn:hover {
- background: ${({ theme }) => theme.colors.bg4};
- cursor: pointer;
+ .react-datepicker__triangle::before, .react-datepicker__triangle::after{
+ border-top-color: ${({ theme }) => theme.colors.bg3} !important;
+ border-bottom-color: ${({ theme }) => theme.colors.bg3} !important;
}
`;
+// TODO: Implement time and datetime
export enum InputType {
DATE,
TIME,
@@ -101,36 +92,23 @@ export const DateInput: React.FC = ({
isValidDate = () => true,
...rest
}) => {
- const { dateFormat, timeFormat } = useMemo(() => {
- if (inputType === InputType.DATETIME) {
- return {
- dateFormat: 'DD/MM/YYYY',
- timeFormat: 'HH:mm:ss A',
- };
- } else if (inputType === InputType.TIME) {
- return {
- dateFormat: false,
- timeFormat: 'HH:mm:ss A',
- };
- }
-
- return {
- dateFormat: 'DD/MM/YYYY',
- timeFormat: false,
- };
- }, [inputType]);
+ const CustomInput = forwardRef(({ value, onClick }: any, ref) => (
+
+ ));
return (
- (
-
- )}
- />
+ <>
+
+ {
+ onChange(moment(date));
+ }}
+ dateFormat={'dd/MM/yyyy'}
+ onMonthChange={() => {}}
+ closeOnScroll={true}
+ customInput={}
+ />
+ >
);
};
diff --git a/yarn.lock b/yarn.lock
index 5f8338044..e6bc5451e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3839,7 +3839,7 @@
schema-utils "^3.0.0"
source-map "^0.7.3"
-"@popperjs/core@^2.9.0":
+"@popperjs/core@^2.9.0", "@popperjs/core@^2.9.2":
version "2.11.6"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45"
integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==
@@ -4154,16 +4154,6 @@
"@sentry/utils" "5.30.0"
tslib "^1.9.3"
-"@sentry/tracing@^7.30.0":
- version "7.30.0"
- resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.30.0.tgz#b4576fbaf81ce418f1b7c37e7e5f4f6cf19a3c3b"
- integrity sha512-bjGeDeKhpGAmLcWcrXFT/xOfHVwp/j0L1aRHzYHnqgTjVzD0NXcooPu/Nz8vF0paxz+hPD5bJwb8kz/ggJzGWQ==
- dependencies:
- "@sentry/core" "7.30.0"
- "@sentry/types" "7.30.0"
- "@sentry/utils" "7.30.0"
- tslib "^1.9.3"
-
"@sentry/types@5.30.0":
version "5.30.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.30.0.tgz#19709bbe12a1a0115bc790b8942917da5636f402"
@@ -5795,6 +5785,13 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-italic/-/extension-italic-2.0.0-beta.199.tgz#db24dbdd0d47fdfaa22dde8ba35e2c08b7162e82"
integrity sha512-jaYJr5ZMxU2swK6h1XJr6Wb1LlWOWbvsX/wo59iZ9KVv1AHiKZlCMcWGThy4aoAs/CUT11pB8qbzyOO163LHZg==
+"@tiptap/extension-link@^2.0.0-beta.209":
+ version "2.0.0-beta.209"
+ resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.0.0-beta.209.tgz#a441f5ead858ea54b88fa7e1a8b5e02e8f671678"
+ integrity sha512-X+iPnKWTb8nuZ7xieemPxZOiCQiaQw4z3RVJ7Hz4/T+ujxfxu7MJhBzjyw9htGPmUijyN4zt0NPjZ089yMzAxQ==
+ dependencies:
+ linkifyjs "^3.0.5"
+
"@tiptap/extension-list-item@^2.0.0-beta.199":
version "2.0.0-beta.199"
resolved "https://registry.yarnpkg.com/@tiptap/extension-list-item/-/extension-list-item-2.0.0-beta.199.tgz#2e667f0ea5d9314307427625345e915edf91b989"
@@ -11926,6 +11923,11 @@ datastore-pubsub@^2.0.0:
interface-datastore "^6.0.2"
uint8arrays "^3.0.0"
+date-fns@^2.24.0:
+ version "2.29.3"
+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
+ integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
+
dateformat@^4.5.1:
version "4.6.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5"
@@ -19923,6 +19925,11 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
+linkifyjs@^3.0.5:
+ version "3.0.5"
+ resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-3.0.5.tgz#99e51a3a0c0e232fcb63ebb89eea3ff923378f34"
+ integrity sha512-1Y9XQH65eQKA9p2xtk+zxvnTeQBG7rdAXSkUG97DmuI/Xhji9uaUzaWxRj6rf9YC0v8KKHkxav7tnLX82Sz5Fg==
+
lint-staged@^12.4.3:
version "12.5.0"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-12.5.0.tgz#d6925747480ae0e380d13988522f9dd8ef9126e3"
@@ -24138,6 +24145,18 @@ react-countdown@^2.3.2:
dependencies:
prop-types "^15.7.2"
+react-datepicker@^4.8.0:
+ version "4.8.0"
+ resolved "https://registry.yarnpkg.com/react-datepicker/-/react-datepicker-4.8.0.tgz#11b8918d085a1ce4781eee4c8e4641b3cd592010"
+ integrity sha512-u69zXGHMpxAa4LeYR83vucQoUCJQ6m/WBsSxmUMu/M8ahTSVMMyiyQzauHgZA2NUr9y0FUgOAix71hGYUb6tvg==
+ dependencies:
+ "@popperjs/core" "^2.9.2"
+ classnames "^2.2.6"
+ date-fns "^2.24.0"
+ prop-types "^15.7.2"
+ react-onclickoutside "^6.12.0"
+ react-popper "^2.2.5"
+
react-datetime@^3.1.1:
version "3.2.0"
resolved "https://registry.yarnpkg.com/react-datetime/-/react-datetime-3.2.0.tgz#fdfa4dced5a9b59724f4c478a1ecc3cb6a6a80cf"
@@ -24244,6 +24263,11 @@ react-error-overlay@^6.0.11:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==
+react-fast-compare@^3.0.1:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
+ integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
+
react-hook-form@^7.29.0:
version "7.38.0"
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.38.0.tgz#53d6a68df587ce4ce88352f63e0ecc7fc8779320"
@@ -24343,6 +24367,19 @@ react-native-url-polyfill@^1.3.0:
dependencies:
whatwg-url-without-unicode "8.0.0-3"
+react-onclickoutside@^6.12.0:
+ version "6.12.2"
+ resolved "https://registry.yarnpkg.com/react-onclickoutside/-/react-onclickoutside-6.12.2.tgz#8e6cf80c7d17a79f2c908399918158a7b02dda01"
+ integrity sha512-NMXGa223OnsrGVp5dJHkuKxQ4czdLmXSp5jSV9OqiCky9LOpPATn3vLldc+q5fK3gKbEHvr7J1u0yhBh/xYkpA==
+
+react-popper@^2.2.5:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.3.0.tgz#17891c620e1320dce318bad9fede46a5f71c70ba"
+ integrity sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==
+ dependencies:
+ react-fast-compare "^3.0.1"
+ warning "^4.0.2"
+
react-refresh@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
@@ -28550,6 +28587,13 @@ walletlink@2.0.2:
preact "^10.3.3"
rxjs "^6.5.4"
+warning@^4.0.2:
+ version "4.0.3"
+ resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
+ integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
+ dependencies:
+ loose-envify "^1.0.0"
+
watchify@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/watchify/-/watchify-4.0.0.tgz#53b002d51e7b0eb640b851bb4de517a689973392"