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

release PR: v0.2.3 #213

Merged
merged 64 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c38acef
fix: Styles on dark mode, mobile (#208)
rafinskipg Oct 27, 2021
bfdf1f7
Use dai.js typescript build (#207)
rafinskipg Oct 28, 2021
d4a5605
Update reach dependencies (#209)
rafinskipg Oct 29, 2021
83ff851
Fix/477: Add filtering on category tags, display the number of filte…
rafinskipg Oct 29, 2021
0794a0c
Add fetch for categories json on validation
adamgoth Nov 1, 2021
60888b2
Update tests
adamgoth Nov 1, 2021
4ed7601
Replace results badge with text design
adamgoth Nov 1, 2021
b83f402
Fix/685 (#212): Changes sort order of polls
rafinskipg Nov 1, 2021
977359f
Add text for expired and not passed
adamgoth Nov 2, 2021
7b72ca5
Refactor
adamgoth Nov 2, 2021
d0d98ee
Merge pull request #216 from makerdao/bug/sc-678/remove-winning-optio…
adamgoth Nov 2, 2021
32be1c3
Merge branch 'develop' of https://github.com/makerdao/governance-port…
adamgoth Nov 2, 2021
ec1bf98
Add mkr needed to pass
adamgoth Nov 2, 2021
f587bee
remove unnecessary space
zdumitru Nov 2, 2021
787f544
Merge pull request #217 from makerdao/minor-fix-remove-unnecessary-space
adamgoth Nov 2, 2021
7fe63e4
Merge branch 'develop' of https://github.com/makerdao/governance-port…
adamgoth Nov 2, 2021
1414c25
Attempt CI update
adamgoth Nov 2, 2021
a6a605d
Merge pull request #215 from makerdao/chore/sc-481/update-categories-…
adamgoth Nov 2, 2021
471d0c2
Undo
adamgoth Nov 2, 2021
888f008
Merge pull request #219 from makerdao/feature/sc-661/add-visual-for-h…
adamgoth Nov 2, 2021
92024d0
Update spell data loading state
adamgoth Nov 3, 2021
edf26e6
Add hat badge to exec detail
adamgoth Nov 3, 2021
69431c8
Merge pull request #221 from makerdao/feature/sc-563/show-governing-p…
adamgoth Nov 4, 2021
eea2c09
style: Update tag colors for dark mode (#222)
adamgoth Nov 4, 2021
bd9f3b4
Add chief balance to system info
adamgoth Nov 4, 2021
1f84e39
Refactor MKR related hooks
adamgoth Nov 4, 2021
4df68d8
Merge pull request #220 from makerdao/bug/sc-666/improve-loading-anim…
adamgoth Nov 4, 2021
41cd34e
Fix/seo and update nextjs (#218)
rafinskipg Nov 4, 2021
18596be
Bump tar from 4.4.13 to 4.4.19
dependabot[bot] Nov 4, 2021
945cc4e
Bump path-parse from 1.0.6 to 1.0.7
dependabot[bot] Nov 4, 2021
2a9a059
Bump tmpl from 1.0.4 to 1.0.5
dependabot[bot] Nov 4, 2021
cb3b553
Merge pull request #226 from makerdao/dependabot/npm_and_yarn/tar-4.4.19
adamgoth Nov 5, 2021
7c06c97
Merge pull request #225 from makerdao/dependabot/npm_and_yarn/path-pa…
adamgoth Nov 5, 2021
6f9ee82
Bump glob-parent from 5.1.1 to 5.1.2
dependabot[bot] Nov 5, 2021
3fac0ae
Bump lodash from 4.17.20 to 4.17.21
dependabot[bot] Nov 5, 2021
76b3e2e
Bump normalize-url from 4.5.0 to 4.5.1
dependabot[bot] Nov 5, 2021
f3c40b1
Bump hosted-git-info from 2.8.8 to 2.8.9
dependabot[bot] Nov 5, 2021
acbf1c9
Add jazzicons for shadow delegates
adamgoth Nov 5, 2021
be33a74
Update for tooltip
adamgoth Nov 5, 2021
90646d1
Merge pull request #224 from makerdao/dependabot/npm_and_yarn/tmpl-1.0.5
adamgoth Nov 5, 2021
ddba606
Merge pull request #228 from makerdao/dependabot/npm_and_yarn/lodash-…
adamgoth Nov 5, 2021
f45f49b
Merge pull request #229 from makerdao/dependabot/npm_and_yarn/normali…
adamgoth Nov 5, 2021
6ce5788
Merge pull request #230 from makerdao/dependabot/npm_and_yarn/hosted-…
adamgoth Nov 5, 2021
b261f1f
Merge pull request #227 from makerdao/dependabot/npm_and_yarn/glob-pa…
adamgoth Nov 5, 2021
ede9728
Add delegate owner badge
adamgoth Nov 5, 2021
e811f2d
Merge pull request #231 from makerdao/feature/sc-748/add-jazzicons-to…
adamgoth Nov 5, 2021
917db81
Merge pull request #223 from makerdao/feature/sc-533/add-mkr-in-chief…
adamgoth Nov 5, 2021
9914a73
Use style var
adamgoth Nov 5, 2021
3dbe24a
Merge pull request #232 from makerdao/feature/sc-667/make-own-shadow-…
adamgoth Nov 5, 2021
b1e6bce
feat: Show delegate MKR weight over time (#173)
b-pmcg Nov 5, 2021
18a0976
Disable file tracing sentry error (#234)
rafinskipg Nov 5, 2021
7333a0c
new lock file
b-pmcg Nov 5, 2021
95ad2af
fix: Tab reload on executive detail
rafinskipg Nov 8, 2021
b95883c
Fix: Chart in mobile do not collide dates
rafinskipg Nov 8, 2021
abd34fd
lint
rafinskipg Nov 8, 2021
41acd46
Change color of LI items in markdown rendering, change Delegated MKR …
rafinskipg Nov 8, 2021
b6b0a90
Disable exec vote button if no vote weight
adamgoth Nov 8, 2021
60be1ea
Format ESM history table for mobile
adamgoth Nov 8, 2021
bc7b180
Remove placeholder text
adamgoth Nov 8, 2021
7030b96
UTC for all
adamgoth Nov 8, 2021
14ebe88
fix executive test: leave some MKR in contract to vote with
b-pmcg Nov 8, 2021
b122ecf
try downgrading reach/tab back to 10.3
tyler17 Nov 8, 2021
4666ad4
Merge branch 'develop' into fix/reach-tab
tyler17 Nov 8, 2021
fee8608
Merge pull request #236 from makerdao/fix/reach-tab
tyler17 Nov 8, 2021
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
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"next/babel",
{
"preset-react": {
// "importSource": "theme-ui", // or "@theme-ui/core"
"runtime": "classic", // Change to automatic when v0.10.0 of theme-ui
"importSource": "@theme-ui/core", // or "@theme-ui/core"
"runtime": "automatic", // Change to automatic when v0.10.0 of theme-ui
"throwIfNamespace": false
}
}
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- run:
name: Install dependencies
command: |
yarn install
yarn
- save_cache:
paths:
- node_modules
Expand All @@ -20,6 +20,7 @@ jobs:
test:
docker:
- image: makerdaodux/dapptools-node-circleci-docker
resource_class: large
steps:
- checkout
- restore_cache:
Expand Down
54 changes: 37 additions & 17 deletions __tests__/lib/polling/validator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,104 +1,124 @@
import { validateText } from 'modules/polling/helpers/validator';
import { validateText, hardcodedCategories } from 'modules/polling/helpers/validator';
import fs from 'fs';
const pollMetadata = fs.readFileSync(__dirname + '/poll-431.md').toString();

test('accept a valid document', () => {
const result = validateText(pollMetadata);
const result = validateText(pollMetadata, hardcodedCategories);
expect(result.valid).toBeTruthy();
expect(result.errors.length).toBe(0);
});

test('reject a blank document', () => {
const result = validateText('');
const result = validateText('', hardcodedCategories);
expect(result.valid).toBeFalsy();
});

test('reject null', () => {
const result = validateText(null);
const result = validateText(null, hardcodedCategories);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('expected input to be a string or buffer');
});

test('reject a document with no options', () => {
const result = validateText(`---
const result = validateText(
`---
vote_type: Plurality Voting
---
# Hello world
`);
`,
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Vote options are missing');
});

test('reject a document with bad options type', () => {
const result = validateText(`---
const result = validateText(
`---
vote_type: Plurality Voting
options: wat
---
# Hello world
`);
`,
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Vote options must be a numbered list');
});

test('reject a document with bad options keys', () => {
const result = validateText(`---
const result = validateText(
`---
vote_type: Plurality Voting
options:
0: foo
1: bar
three: baz
---
# Hello world
`);
`,
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Vote option IDs must be numbers');
});

test('reject a document with invalid vote type', () => {
const result = validateText(pollMetadata.replace('Plurality', 'Blurality'));
const result = validateText(pollMetadata.replace('Plurality', 'Blurality'), hardcodedCategories);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Invalid vote type: "Blurality Voting"');
});

test('reject a document with no categories', () => {
const result = validateText(`---
const result = validateText(
`---
vote_type: Plurality Voting
options:
0: foo
1: bar

---
# Hello world`);
# Hello world`,
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Categories are missing');
});

test('reject a document with invalid category', () => {
const result = validateText(
pollMetadata.replace('Technical', 'Jechnical').replace('Risk Variable', 'Zisk Zariable')
pollMetadata.replace('Technical', 'Jechnical').replace('Risk Variable', 'Zisk Zariable'),
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Invalid categories: Zisk Zariable, Jechnical');
});

test('reject a document with a missing date', () => {
const result = validateText(pollMetadata.replace('start_date', 'x').replace('end_date', 'y'));
const result = validateText(
pollMetadata.replace('start_date', 'x').replace('end_date', 'y'),
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Start date is missing');
expect(result.errors).toContain('End date is missing');
});

test('reject a document with an invalid date', () => {
const result = validateText(
pollMetadata.replace(/start_date: .*/, 'start_date: foo').replace(/end_date: .*/, 'end_date: bar')
pollMetadata.replace(/start_date: .*/, 'start_date: foo').replace(/end_date: .*/, 'end_date: bar'),
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Invalid start date (should be like "2020-08-16T08:00:00")');
expect(result.errors).toContain('Invalid end date (should be like "2020-08-16T08:00:00")');
});

test('reject a document with an invalid duration', () => {
const result = validateText(pollMetadata.replace(/end_date: .*/, 'end_date: 2021-01-18T16:59:00'));
const result = validateText(
pollMetadata.replace(/end_date: .*/, 'end_date: 2021-01-18T16:59:00'),
hardcodedCategories
);
expect(result.valid).toBeFalsy();
expect(result.errors).toContain('Poll duration is too short');
});
4 changes: 2 additions & 2 deletions __tests__/pages/executive.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Executive page', () => {

await screen.findByText('Withdraw from voting contract');
const inputWithdraw = screen.getByTestId('mkr-input');
fireEvent.change(inputWithdraw, { target: { value: '10' } });
fireEvent.change(inputWithdraw, { target: { value: '6' } });

const finalDepositButtonWithdraw = await screen.findByText('Withdraw MKR');

Expand All @@ -88,7 +88,7 @@ describe('Executive page', () => {

const lockedMKR = await screen.findByTestId('locked-mkr');

expect(lockedMKR).toHaveTextContent(/^0.000000 MKR$/); //find exact match
expect(lockedMKR).toHaveTextContent(/^4.000000 MKR$/); //find exact match
});

test('can vote', async () => {
Expand Down
5 changes: 3 additions & 2 deletions lib/datetime.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { format } from 'date-fns';
import { format, utcToZonedTime } from 'date-fns-tz';

export const formatDateWithTime = (dateString: Date | undefined | number | string): string => {
if (!dateString) return '';

const date = new Date(dateString);
const utcTime = utcToZonedTime(date, 'UTC');

try {
return format(date, 'MMM dd yyyy HH:mm zz');
return format(utcTime, 'MMM dd yyyy HH:mm zz', { timeZone: 'UTC' });
} catch (err) {
return '--';
}
Expand Down
5 changes: 0 additions & 5 deletions lib/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
export * from './useMkrBalance';
export * from './useTokenAllowance';
export * from './useMkrDelegated';
export * from './useLockedMkr';
export * from './useHat';
export * from './useAllSlates';
export * from './useAllUserVotes';
export * from './useDelegateAddressMap';
17 changes: 9 additions & 8 deletions lib/maker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import { Web3ReactPlugin } from './web3react';
import { SupportedNetworks, DEFAULT_NETWORK } from '../constants';
import { networkToRpc } from './network';
import { config } from '../config';
import { MakerClass } from '@makerdao/dai/dist/Maker';

export const ETH = Maker.ETH;
export const USD = Maker.USD;
export const ETH = Maker.currencies.ETH;
export const USD = Maker.currencies.USD;
export { MKR };

function chainIdToNetworkName(chainId: number): SupportedNetworks {
Expand Down Expand Up @@ -67,10 +68,10 @@ function determineNetwork(): SupportedNetworks {
}

type MakerSingletons = {
[SupportedNetworks.MAINNET]: null | Promise<Maker>;
[SupportedNetworks.KOVAN]: null | Promise<Maker>;
[SupportedNetworks.GOERLI]: null | Promise<Maker>;
[SupportedNetworks.TESTNET]: null | Promise<Maker>;
[SupportedNetworks.MAINNET]: null | Promise<MakerClass>;
[SupportedNetworks.KOVAN]: null | Promise<MakerClass>;
[SupportedNetworks.GOERLI]: null | Promise<MakerClass>;
[SupportedNetworks.TESTNET]: null | Promise<MakerClass>;
};

const makerSingletons: MakerSingletons = {
Expand All @@ -80,7 +81,7 @@ const makerSingletons: MakerSingletons = {
[SupportedNetworks.TESTNET]: null
};

async function getMaker(network?: SupportedNetworks): Promise<Maker> {
async function getMaker(network?: SupportedNetworks): Promise<MakerClass> {
// Chose the network we are referring to or default to the one set by the system
const currentNetwork = network ? network : getNetwork();

Expand All @@ -107,7 +108,7 @@ async function getMaker(network?: SupportedNetworks): Promise<Maker> {
makerSingletons[currentNetwork] = instance;
}

return makerSingletons[currentNetwork];
return makerSingletons[currentNetwork] as Promise<MakerClass>;
}

let networkSingleton: SupportedNetworks;
Expand Down
69 changes: 67 additions & 2 deletions lib/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,38 @@ export default {
ornament: '#000',
skeletonColor: '#EEE',
skeletonHighlightColor: '#F5F5F5',
tagColorOne: '#D44C96',
tagColorOneBg: '#FFF4FA',
tagColorTwo: '#8F2EC1',
tagColorTwoBg: '#FBF2FF',
tagColorThree: '#02CB9B',
tagColorThreeBg: '#EBFFFA',
tagColorFour: '#FF4085',
tagColorFourBg: '#FFF0F4',
tagColorFive: '#EF5277',
tagColorFiveBg: '#FEEEF2',
tagColorSix: '#5D48FF',
tagColorSixBg: '#F7F5FF',
tagColorSeven: '#7D8FAA',
tagColorSevenBg: '#F2F5FA',
tagColorEight: '#00B5D3',
tagColorEightBg: '#EEFAFC',
tagColorNine: '#34AAFF',
tagColorNineBg: '#F1F9FF',
tagColorTen: '#FF8237',
tagColorTenBg: '#FFF5EF',
tagColorEleven: '#1AAB9B',
tagColorElevenBg: '#EEFFFD',
tagColorTwelve: '#635696',
tagColorTwelveBg: '#F7F4FF',
tagColorThirteen: '#E7C200',
tagColorThirteenBg: '#FFFBEF',
tagColorFourteen: '#FF36C7',
tagColorFourteenBg: '#FFF3F8',
tagColorFifteen: '#FF8237',
tagColorFifteenBg: '#FFFBEF',
tagColorSixteen: '#FF8237',
tagColorSixteenBg: '#FFFBEF',
modes: {
dark: {
primary: '#1DC1AE',
Expand All @@ -53,7 +85,39 @@ export default {
successAlt: '#002C26',
onSuccess: '#1DC1AE',
skeletonColor: '#000',
skeletonHighlightColor: '#141414'
skeletonHighlightColor: '#141414',
tagColorOne: '#D44C96',
tagColorOneBg: '#121212',
tagColorTwo: '#8F2EC1',
tagColorTwoBg: '#121212',
tagColorThree: '#02CB9B',
tagColorThreeBg: '#121212',
tagColorFour: '#FF4085',
tagColorFourBg: '#121212',
tagColorFive: '#EF5277',
tagColorFiveBg: '#121212',
tagColorSix: '#5D48FF',
tagColorSixBg: '#121212',
tagColorSeven: '#7D8FAA',
tagColorSevenBg: '#121212',
tagColorEight: '#00B5D3',
tagColorEightBg: '#121212',
tagColorNine: '#34AAFF',
tagColorNineBg: '#121212',
tagColorTen: '#FF8237',
tagColorTenBg: '#121212',
tagColorEleven: '#1AAB9B',
tagColorElevenBg: '#121212',
tagColorTwelve: '#635696',
tagColorTwelveBg: '#121212',
tagColorThirteen: '#E7C200',
tagColorThirteenBg: '#121212',
tagColorFourteen: '#FF36C7',
tagColorFourteenBg: '#121212',
tagColorFifteen: '#FF8237',
tagColorFifteenBg: '#121212',
tagColorSixteen: '#FF8237',
tagColorSixteenBg: '#121212'
}
}
},
Expand Down Expand Up @@ -298,7 +362,8 @@ export default {
my: 2
},
li: {
fontSize: [2, 3]
fontSize: [2, 3],
color: 'textSecondary'
},
a: {
color: 'accentBlue',
Expand Down
1 change: 0 additions & 1 deletion modules/address/components/AddressDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import React from 'react';
import { jsx, Box, Text, Link as ExternalLink, Flex, Divider } from 'theme-ui';
import { useBreakpointIndex } from '@theme-ui/match-media';
Expand Down
1 change: 0 additions & 1 deletion modules/address/components/AddressIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import { jsx, Box } from 'theme-ui';
import { Jazzicon } from '@ukstv/jazzicon-react';

Expand Down
2 changes: 0 additions & 2 deletions modules/app/components/Cookies.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx jsx */

import React, { useContext } from 'react';

import Link from 'next/link';
Expand Down
1 change: 0 additions & 1 deletion modules/app/components/CountdownTimer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import { useState } from 'react';
import { Text, Flex, jsx, ThemeUIStyleObject } from 'theme-ui';
import { Icon } from '@makerdao/dai-ui-icons';
Expand Down
3 changes: 1 addition & 2 deletions modules/app/components/FilterButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import { jsx } from 'theme-ui';
import { Icon } from '@makerdao/dai-ui-icons';
import { Menu, MenuButton, MenuList } from '@reach/menu-button';
Expand All @@ -13,7 +12,7 @@ export default function FilterButton({
}: Props): JSX.Element {
return (
<Menu>
<MenuButton sx={{ variant: 'buttons.outline' }} {...props}>
<MenuButton sx={{ variant: 'buttons.outline', lineHeight: 'inherit' }} {...props}>
{name()}
<Icon name="chevron_down" size={2} ml={2} />
</MenuButton>
Expand Down
1 change: 0 additions & 1 deletion modules/app/components/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import { jsx } from 'theme-ui';

import React from 'react';
Expand Down
1 change: 0 additions & 1 deletion modules/app/components/PageLoadingPlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import Skeleton from 'modules/app/components/SkeletonThemed';
import { Box, jsx } from 'theme-ui';

Expand Down
1 change: 0 additions & 1 deletion modules/app/components/ResourceBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @jsx jsx */
import { Box, Heading, Card, Link as ExternalLink, Flex, Text, jsx } from 'theme-ui';
import { Icon } from '@makerdao/dai-ui-icons';

Expand Down
Loading