Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot Remove SimplePicker #1271

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ import 'pages/new_proposal_page.scss';
import $ from 'jquery';
import m from 'mithril';
import mixpanel from 'mixpanel-browser';
import { Input, Form, FormLabel, FormGroup, Button, Callout, Spinner } from 'construct-ui';
import { Input, Form, FormLabel, FormGroup, Button, Callout, Spinner, RadioGroup } from 'construct-ui';

import moment from 'moment';
import snapshotJs from '@snapshot-labs/snapshot.js';

import app from 'state';

import { formatSpace } from 'helpers/snapshot_utils/snapshot_utils';

import { notifyError } from 'controllers/app/notifications';
import QuillEditor from 'views/components/quill_editor';
import { idToProposal } from 'identifiers';
import { capitalize } from 'lodash';
import SimplePicker from 'simplepicker';
import { ChainBase, IWebWallet } from 'models';
import MetamaskWebWalletController from 'controllers/app/webWallets/metamask_web_wallet';

interface IThreadForm {
name: string;
body: string;
choices: string[];
range: string;
start: number;
end: number;
snapshot: number,
Expand Down Expand Up @@ -152,8 +149,9 @@ export const NewProposalForm: m.Component<{snapshotId: string}, {
name: '',
body: '',
choices: ['Yes', 'No'],
start: 0,
end: 0,
range: '3d',
start: new Date().getTime(),
end: moment().add(3, 'days').toDate().getTime(),
snapshot: 0,
metadata: {},
type: 'single-choice'
Expand Down Expand Up @@ -289,40 +287,38 @@ export const NewProposalForm: m.Component<{snapshotId: string}, {
]),
]),
m(FormGroup, [
m(FormGroup, [
m(FormLabel, 'Start Date:'),
m(Input, {
// defaultValue: vnode.state.isFromExistingProposal ? today.toDateString() : ' ',
name: 'targets',
placeholder: 'May 1, 1995',
value: moment(vnode.state.form.start || new Date()).format('DD MMM YYYY hh:mm A'),
onclick: () => {
const myPicker = new SimplePicker({ zIndex: 1000 });
myPicker.open();
myPicker.on('submit', (date: Date, readableDate: string) => {
vnode.state.form.start = date.getTime();
m.redraw();
});
},
}),
]),
m(FormGroup, [
m(FormLabel, 'End Date:'),
m(Input, {
// defaultValue: vnode.state.isFromExistingProposal ? nextWeek.toDateString() : ' ',
name: 'targets',
placeholder: 'May 22, 1995',
value: moment(vnode.state.form.end || new Date()).format('DD MMM YYYY hh:mm A'),
onclick: () => {
const myPicker = new SimplePicker({ zIndex: 1000 });
myPicker.open();
myPicker.on('submit', (date: Date, readableDate: string) => {
vnode.state.form.end = date.getTime();
m.redraw();
});
},
}),
]),
m(FormLabel, { for: 'period' }, 'Date Range:'),
m(RadioGroup, {
name: 'period',
options: [
{ value: '3d', label: '3-day' },
{ value: '7d', label: '7-day' },
{ value: '2w', label: '2 weeks' },
{ value: '4w', label: '4 weeks' },
],
value: vnode.state.form.range,
onchange: (e: Event) => {
vnode.state.form.range = (e.target as any).value;
vnode.state.form.start = new Date().getTime();
switch (vnode.state.form.range) {
case '3d':
vnode.state.form.end = moment().add(3, 'days').toDate().getTime();
break;
case '7d':
vnode.state.form.end = moment().add(7, 'days').toDate().getTime();
break;
case '2w':
vnode.state.form.end = moment().add(2, 'weeks').toDate().getTime();
break;
case '4w':
vnode.state.form.end = moment().add(4, 'weeks').toDate().getTime();
break;
default:
break;
}
console.log(vnode.state.form);
},
}),
]),
m(FormGroup, [
m(QuillEditor, {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"sequelize": "^4.42.0",
"sequelize-cli": "^5.4.0",
"serve-favicon": "^2.5.0",
"simplepicker": "^2.0.4",
"sleep-promise": "^8.0.1",
"smart-truncate": "^1.0.1",
"source-map": "^0.7.3",
Expand Down
26 changes: 1 addition & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15283,7 +15283,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"

"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1:
"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
Expand Down Expand Up @@ -15572,14 +15572,6 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"

simplepicker@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/simplepicker/-/simplepicker-2.0.4.tgz#a8c24dc1058a467be3e91d2623285f009c97c3fd"
integrity sha512-A3XnoPRFuVEKaleQP2sdpK8DVav91kMmUexU3GSFsszU79GUwJSJx9vTmgzqPngjbfxTA2OHVOP3SDfT396VZg==
dependencies:
ts-loader "^5.4.3"
typescript "^3.4.5"

simplestatemanager@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/simplestatemanager/-/simplestatemanager-4.1.1.tgz#723879947cd8a40dd20645a0ee6a7cadcc669d4f"
Expand Down Expand Up @@ -16843,17 +16835,6 @@ ts-invariant@^0.8.0:
dependencies:
tslib "^2.1.0"

ts-loader@^5.4.3:
version "5.4.5"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.4.5.tgz#a0c1f034b017a9344cef0961bfd97cc192492b8b"
integrity sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw==
dependencies:
chalk "^2.3.0"
enhanced-resolve "^4.0.0"
loader-utils "^1.0.2"
micromatch "^3.1.4"
semver "^5.0.1"

ts-loader@^6.2.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.1.tgz#67939d5772e8a8c6bdaf6277ca023a4812da02ef"
Expand Down Expand Up @@ -17132,11 +17113,6 @@ typescript-logging@^0.6.4:
dependencies:
stacktrace-js "1.3.1"

typescript@^3.4.5:
version "3.9.10"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8"
integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==

typescript@^4.2.0:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
Expand Down