-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update chakra imports * Update AspectRadio * Update Skeleton * Update Profile screen * Update bordered radio variant Remove testing stubs * Update Flips screens * Update Contacts screen * Update Voting list screen * Update voting view screen * Update settings components * Update voting dialogs * Update Prize pool icon * Add basic Ad screens * Add Ad edit screen Add dexie db * Make ads deployable * Review and burn ads * Add pb models * Move to ad drawers * Move Add stake drawer to ads * Remove unused pb code Fix linting errors * Set width for onboarding mining popover * Update icons * Update Profile --> Home * Add update Home components * Remove outdated profile penalty tag Nail component styles * Render popover w/ display none is not open Nail styles * Update flip editor arrow helpers position Flip wallet tx icons * Add Publish flip drawer Update flip styles * Update staking APY calculation * Add validation ads * Nail validation ad styles * Update voting drawer footers * Sort ads by targeting score * Remove truncating oracle desc * Update ad drawer styles Handle loading ad offers * Remove ad drawer tester * Update image search styles * Rework SendDna form * Nail wallet ts list styles * Trim long ad url * Handle flips w/out noise * Update dayjs package * Reset timers on duration change Update test cases w/ new home route * Show estimatedTerminationTime for Termination date * Batch read ad contract data * Skip Sync screen when hardfork Nail hardfork styles * Hide overflowing links * Allow setting owner fee for ad voting * Refetch identity after adding ad * Add validation ads animation * Nail Review ad drawer styles * Update Bad flip dialog styles * Consider rewardsFund when creating ad voting * Check for images before protecting * Enable flip noise conditionally * Adjust flip noise feature flagging * Check for voting result before persisting * Throw when incorrect dna send params * Respect FLIP_NOISE_EPOCH_START env * Skip animations if no ads * Refactor hooks and util fns * Persist and restore validation reports as the Set * Truncate ad links * Rework handling flip noise * Handle flip mining * Fix APY calculation * Fix lint * Check FLIP_NOISE_EPOCH_START for null * Truncate ad link in create campaign drawer * Return ad target in useProfileAds * Adjust ad offer list styles Nail validation ad styles * Add Age, Stake for nullish targeting * Rotate validation nav buttons * Workaround popover inset not being supported * Format oracle prize pool with 4 fraction digits Expose single useFormatDna hook Nail onboarding popover styles Co-authored-by: ridenaio <[email protected]>
- Loading branch information
Showing
97 changed files
with
13,723 additions
and
4,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
renderer/.next | ||
renderer/out | ||
**/dist | ||
renderer/shared/proto | ||
**/shared/models/proto/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"mainWindowUrl": "http://localhost:8000/profile", | ||
"mainWindowUrl": "http://localhost:8000/home", | ||
"appPath": "./" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import * as React from 'react' | ||
import {Box, HStack, Text, useDisclosure} from '@chakra-ui/react' | ||
import {useRouter} from 'next/router' | ||
import {useTranslation} from 'react-i18next' | ||
import Layout from '../../shared/components/layout' | ||
import {AdForm, AdPreview} from '../../screens/ads/containers' | ||
import {PrimaryButton, SecondaryButton} from '../../shared/components/button' | ||
import { | ||
PageHeader, | ||
PageCloseButton, | ||
PageFooter, | ||
} from '../../screens/ads/components' | ||
import {useCoinbase, usePersistedAd} from '../../screens/ads/hooks' | ||
import {isValidImage} from '../../screens/ads/utils' | ||
import {Page, PageTitle} from '../../shared/components/components' | ||
import {dexieDb} from '../../shared/utils/dexieDb' | ||
import {ArrowRightIcon} from '../../shared/components/icons' | ||
|
||
export default function EditAdPage() { | ||
const {t} = useTranslation() | ||
|
||
const router = useRouter() | ||
|
||
const {data: ad} = usePersistedAd(router.query.id) | ||
|
||
const coinbase = useCoinbase() | ||
|
||
const adFormRef = React.useRef() | ||
|
||
const previewAdRef = React.useRef() | ||
|
||
const previewDisclosure = useDisclosure() | ||
|
||
return ( | ||
<Layout showHamburger={false}> | ||
<Page px={0} py={0} overflow="hidden"> | ||
<Box flex={1} w="full" px={20} py={6} overflowY="auto"> | ||
<PageHeader> | ||
<PageTitle mb={0}>{t('Edit ad')}</PageTitle> | ||
<PageCloseButton href="/adn/list" /> | ||
</PageHeader> | ||
|
||
<AdForm | ||
ref={adFormRef} | ||
id="adForm" | ||
ad={ad} | ||
onSubmit={async nextAd => { | ||
await dexieDb.table('ads').update(ad.id, nextAd) | ||
router.push('/adn/list') | ||
}} | ||
/> | ||
</Box> | ||
|
||
<PageFooter> | ||
<SecondaryButton | ||
onClick={async () => { | ||
const currentAd = Object.fromEntries( | ||
new FormData(adFormRef.current).entries() | ||
) | ||
|
||
previewAdRef.current = { | ||
...ad, | ||
...currentAd, | ||
author: ad.author ?? coinbase, | ||
thumb: isValidImage(currentAd.thumb) | ||
? URL.createObjectURL(currentAd.thumb) | ||
: ad.thumb, | ||
media: isValidImage(currentAd.media) | ||
? URL.createObjectURL(currentAd.media) | ||
: ad.media, | ||
} | ||
|
||
previewDisclosure.onOpen() | ||
}} | ||
> | ||
<HStack> | ||
<ArrowRightIcon boxSize="5" /> | ||
<Text>{t('Show preview')}</Text> | ||
</HStack> | ||
</SecondaryButton> | ||
<PrimaryButton form="adForm" type="submit"> | ||
{t('Save')} | ||
</PrimaryButton> | ||
</PageFooter> | ||
</Page> | ||
|
||
<AdPreview ad={previewAdRef.current} {...previewDisclosure} /> | ||
</Layout> | ||
) | ||
} |
Oops, something went wrong.