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

Price Oracle #230

Closed
wants to merge 188 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
cf5e556
added basics of filtering and sorting
BenKurrek Feb 21, 2024
7bdc801
added enter handler for searching
BenKurrek Feb 21, 2024
0c5a4b9
added pagination css
BenKurrek Feb 21, 2024
af15c6a
mobile fixed
BenKurrek Feb 22, 2024
de48585
dynamic pagination when filters applied
BenKurrek Feb 22, 2024
51020f6
changed empty drops messages if filters are empty
BenKurrek Feb 22, 2024
9b2e327
slight wording change
BenKurrek Feb 22, 2024
c089e35
set page to zero when new filters are applied
BenKurrek Feb 22, 2024
228ca32
fixed up warnings and hopefully build passes now
BenKurrek Feb 22, 2024
3025500
more warning fixes
BenKurrek Feb 22, 2024
8dc21d6
more warning fixes
BenKurrek Feb 22, 2024
68a27fa
more warning fixes
BenKurrek Feb 22, 2024
9ab2a27
Merge pull request #217 from keypom/feat/my-drops-page
BenKurrek Feb 23, 2024
daa1381
Added yarn devwindows
WAEliasmith Feb 23, 2024
6094221
major refactor of keypom utils and started work on nft drop manager
BenKurrek Feb 24, 2024
e196472
figma implemented for nft pages
BenKurrek Feb 24, 2024
2d9ff13
fix warnings
BenKurrek Feb 24, 2024
1d3f917
fixed mobile table css
BenKurrek Feb 24, 2024
209cc00
finished new caching logic and nft drops page
BenKurrek Feb 24, 2024
23cb42a
Added WIP Gallery, Secondary Gallery, dynamic Events page
WAEliasmith Feb 24, 2024
eb3ce98
eslint fix
WAEliasmith Feb 25, 2024
7566b4d
final commits
BenKurrek Feb 25, 2024
5ad1800
final css
BenKurrek Feb 25, 2024
8cae77c
switched placeholder for nft
BenKurrek Feb 25, 2024
779096e
abstracted all drops page and started working on all events page
BenKurrek Feb 26, 2024
a08dd5e
Fixed up gallery UI to better match examples
WAEliasmith Feb 26, 2024
f731f97
Fixed style checks
WAEliasmith Feb 26, 2024
1e3ef7e
Added gradient
WAEliasmith Feb 26, 2024
99d6e9d
started work on events page
BenKurrek Feb 28, 2024
1679d62
loooaaddss of work
BenKurrek Feb 28, 2024
d6dde19
fixed warnings
BenKurrek Feb 28, 2024
bf7d1ba
added share button at top right of event page
BenKurrek Feb 28, 2024
2cec1bb
working on individual ticket page
BenKurrek Feb 29, 2024
3662097
Gallery and events page
WAEliasmith Feb 29, 2024
5256feb
Merge branch 'feat/nft-drops' into Gallery
WAEliasmith Feb 29, 2024
8572b16
fixed small race condition in pagination logic
BenKurrek Feb 29, 2024
160c32b
first pass at finished css done
BenKurrek Feb 29, 2024
4c5137f
fixed small breadcrumb issue
BenKurrek Feb 29, 2024
36c2e37
Merge pull request #219 from keypom/feat/nft-drops
BenKurrek Feb 29, 2024
8429567
WIP gallery revamp
WAEliasmith Mar 2, 2024
d3d1590
fixing mobile layouts
BenKurrek Mar 2, 2024
dd8d8c9
Many frontend fixes and changes
7axel7 Mar 3, 2024
720b17f
fix modal lags
BenKurrek Mar 3, 2024
548edac
fix build
BenKurrek Mar 3, 2024
da50d11
fixing mobile layout IDs, fixed centered actions
BenKurrek Mar 4, 2024
90ba248
check types
BenKurrek Mar 4, 2024
e6f1241
Many changes for the gallery and events page prototypes
7axel7 Mar 4, 2024
8296d3c
A bunch of changes to get the gallery and events page into a suitable…
WAEliasmith Mar 4, 2024
9626d24
eslint fix 1
WAEliasmith Mar 4, 2024
65cc17e
More styling fixes and abstraction
WAEliasmith Mar 4, 2024
aa4fb3a
events WIP
WAEliasmith Mar 5, 2024
96cd8be
Merge branch 'feat/my-events-page' into gallery
WAEliasmith Mar 5, 2024
c684dc8
Integration day 1
WAEliasmith Mar 5, 2024
8c25252
finished first pass at ticket deletion
BenKurrek Mar 5, 2024
aecb8cd
Daily updates for gallery
WAEliasmith Mar 6, 2024
90c3100
started port to new interface and contracts
BenKurrek Mar 7, 2024
5446c52
more changes.......
BenKurrek Mar 7, 2024
4298cca
fully functioning deletion and consolidated event manager page into j…
BenKurrek Mar 7, 2024
0e215d6
encryption implemented
BenKurrek Mar 7, 2024
7b92211
daily changes for gallery
WAEliasmith Mar 7, 2024
09ec847
final commit
BenKurrek Mar 7, 2024
fb6f578
change base contract and small bugfix
BenKurrek Mar 7, 2024
4b4a951
final changes
BenKurrek Mar 8, 2024
de2675e
Merge branch 'feat/my-events-page' into Gallery
WAEliasmith Mar 8, 2024
549d59e
build fixes
BenKurrek Mar 8, 2024
a18faef
Merge pull request #220 from keypom/feat/my-events-page
BenKurrek Mar 8, 2024
55c45da
wip new data
WAEliasmith Mar 8, 2024
befdc8c
Merge branch 'fydp' into Gallery
WAEliasmith Mar 8, 2024
25cb287
daily gallery updates friday
WAEliasmith Mar 8, 2024
6f1438b
temp fixes and debugggin
BenKurrek Mar 8, 2024
65e94cb
fixed csv issues
BenKurrek Mar 8, 2024
8e5b356
fixed date sorting
BenKurrek Mar 8, 2024
e820d95
final commit
BenKurrek Mar 8, 2024
22eb331
Merge pull request #223 from keypom/fix/event-manager
BenKurrek Mar 8, 2024
6c7ee7f
qr codes finished
BenKurrek Mar 8, 2024
398cb48
implemented error checking and skeleton loaders
BenKurrek Mar 8, 2024
cab23ea
Merge pull request #224 from keypom/feat/ticket-qr
BenKurrek Mar 8, 2024
fe2deb5
Merge branch 'fydp' into Gallery
WAEliasmith Mar 9, 2024
fcfed12
custom date range picker beginning implementation
BenKurrek Mar 9, 2024
f50a46d
date range picker finished
BenKurrek Mar 9, 2024
07e22be
working on event preview page
BenKurrek Mar 10, 2024
9c6d838
about to refactor
BenKurrek Mar 11, 2024
5cda669
successful refactor
BenKurrek Mar 11, 2024
f2d01d1
finalized step 3
BenKurrek Mar 12, 2024
1e2ee2e
daily gallery and events page update
WAEliasmith Mar 12, 2024
079b819
almost finished ticket creation page
BenKurrek Mar 13, 2024
1afb2d7
first pass at ticket creation tab
BenKurrek Mar 13, 2024
dbc661d
preview modal progress
BenKurrek Mar 14, 2024
cc05f71
secondary market and purchase WIP
WAEliasmith Mar 14, 2024
1d00a92
Merge branch 'feat/create-tickets' into Gallery
WAEliasmith Mar 14, 2024
165cbb9
cleared build errors
BenKurrek Mar 14, 2024
38dd1ba
first pass at review details
BenKurrek Mar 14, 2024
b7fd94a
fix build
BenKurrek Mar 14, 2024
a534120
first pass at event creation pseudo successful
BenKurrek Mar 14, 2024
10ee3d6
first pass at cost breakdown
BenKurrek Mar 14, 2024
9aa5414
ticket creation almost finished
BenKurrek Mar 14, 2024
16dd3cb
Daily update, demo working
WAEliasmith Mar 15, 2024
cb7c020
build errors
BenKurrek Mar 15, 2024
c69da93
Merge branch 'feat/create-tickets' into Gallery
WAEliasmith Mar 15, 2024
17969ed
small fix after merge
WAEliasmith Mar 15, 2024
bacd54e
getting ready for demo
BenKurrek Mar 15, 2024
f31d0ab
full functioning demo
BenKurrek Mar 15, 2024
68cb466
changes to navbar and modals
BenKurrek Mar 18, 2024
031d9a5
started work on linting errors
BenKurrek Mar 18, 2024
0b1fbc9
began working on QOL code changes
BenKurrek Mar 19, 2024
14a7657
changed estimator
BenKurrek Mar 19, 2024
89ee0e0
reset button for date time picker, date validation in event creation,…
BenKurrek Mar 19, 2024
1d12f69
stripe and free integration
WAEliasmith Mar 19, 2024
ee4e529
refactor time picker
BenKurrek Mar 19, 2024
7964214
refactor placeholder text for date
BenKurrek Mar 19, 2024
3d8f657
added proper redirects for events managers
BenKurrek Mar 19, 2024
0446100
Merge pull request #226 from keypom/chore/ticket-creation
WAEliasmith Mar 19, 2024
358900c
added sell button and removed connect button from navbar
BenKurrek Mar 19, 2024
d3c0625
added no connect button on mobile
BenKurrek Mar 19, 2024
979d31b
fixed bugs introduced with fresh builds and no caching
BenKurrek Mar 19, 2024
01ab153
changed worker base URL
BenKurrek Mar 19, 2024
0ff9228
added gitattributes file
WAEliasmith Mar 19, 2024
4c793b4
changed vcproj to lf in gitattributes
WAEliasmith Mar 19, 2024
8283325
loads of progress on events pages
BenKurrek Mar 20, 2024
f8b402d
added new nft keys logic to drop creation
BenKurrek Mar 20, 2024
4e35136
added price oracle
BenKurrek Mar 20, 2024
efadc10
eslint fixes
WAEliasmith Mar 21, 2024
c16ac7d
added stripe page and made price oracle more robust with pings
BenKurrek Mar 21, 2024
4c61b04
renamed price to priceNear in tickets
BenKurrek Mar 22, 2024
2806bdf
new build
BenKurrek Mar 22, 2024
7580b17
testing for min
BenKurrek Mar 22, 2024
2b54a2d
added modals to event creation page
BenKurrek Mar 22, 2024
1ebc3ec
fixed a bunch of type checks
WAEliasmith Mar 22, 2024
5c91f76
final fixes - for some reason file input is broken...
BenKurrek Mar 22, 2024
0aa273c
Merge branch 'feat/qr-page' into Gallery
WAEliasmith Mar 22, 2024
1893317
Merge branch 'chore/fresh-build-tests' into Gallery
WAEliasmith Mar 22, 2024
08179fc
added dates and more info to qr ticket pages
BenKurrek Mar 22, 2024
5261d7f
removed eslint errors and warnings
WAEliasmith Mar 22, 2024
974ac71
basic scanning ui finished
BenKurrek Mar 22, 2024
0c264c4
more work on scanner
BenKurrek Mar 23, 2024
11efab6
fixed state bug
BenKurrek Mar 23, 2024
03ab928
Fixed more check-types
WAEliasmith Mar 23, 2024
4632041
Merge pull request #218 from keypom/Gallery
WAEliasmith Mar 23, 2024
e40a564
added gitattributes to remove crlf error
WAEliasmith Mar 23, 2024
a8d64e6
first pass at scanner
BenKurrek Mar 23, 2024
9bfed27
removed bad check
WAEliasmith Mar 23, 2024
d893fcb
fixed 0 price issue
WAEliasmith Mar 23, 2024
31a1839
fixed submitmodal issue
WAEliasmith Mar 23, 2024
c7c8b66
Merge pull request #233 from keypom/fix-sold-out-issue
WAEliasmith Mar 23, 2024
ff9ec04
fixed name on gitattributes
WAEliasmith Mar 23, 2024
268e147
first pass at purchase modal refactor
BenKurrek Mar 23, 2024
6eb262c
Merge branch 'fydp' into refactor/nft-metadata
WAEliasmith Mar 23, 2024
f47172c
proper modal transitions between tickets and no tickets. No mobile atm
BenKurrek Mar 23, 2024
8e9e83b
WIP dateparsing
WAEliasmith Mar 23, 2024
7587d02
fixed mobile spacing
WAEliasmith Mar 23, 2024
1eabd1f
final modal
BenKurrek Mar 23, 2024
af97616
Updated events page and verifymodal to work with new nft-metadata and…
WAEliasmith Mar 24, 2024
adf670c
merging error and types fixes
WAEliasmith Mar 24, 2024
00d478a
fixed lint error
WAEliasmith Mar 24, 2024
a94da61
Merge pull request #229 from keypom/refactor/nft-metadata
WAEliasmith Mar 24, 2024
510ae52
ref refactor but bugs due to re-renders of components
BenKurrek Mar 24, 2024
57dec47
Merge branch 'fydp' into refactor/nft-metadata
WAEliasmith Mar 24, 2024
0496ce4
Merge pull request #231 from keypom/refactor/qr-page
WAEliasmith Mar 24, 2024
ed16f35
fixed the state bugs
BenKurrek Mar 24, 2024
dc5f2c6
Merge branch 'fydp' into feat/new-scanner-pages
WAEliasmith Mar 24, 2024
77093fe
fixed ticket state
BenKurrek Mar 24, 2024
4328ef2
fixed types
WAEliasmith Mar 24, 2024
e888f7f
initial pass at new ui
BenKurrek Mar 24, 2024
0ea02ab
Merge pull request #232 from keypom/feat/new-scanner-pages
WAEliasmith Mar 24, 2024
2f43b43
Merge branch 'fydp' into feat/new-purchase-modals
WAEliasmith Mar 24, 2024
5a233d6
final UI changes
BenKurrek Mar 24, 2024
bea2002
added standardized email address to user questions
BenKurrek Mar 24, 2024
62955ae
fixed clearing details
BenKurrek Mar 24, 2024
15fe191
fixed to updated market and ticketing
WAEliasmith Mar 24, 2024
c7316a9
Merge pull request #236 from keypom/feat/new-purchase-modals
WAEliasmith Mar 24, 2024
19fae8a
modified sizing
BenKurrek Mar 24, 2024
7d59494
new date and time info instead of event date
BenKurrek Mar 24, 2024
bc0fe93
Merge branch 'fydp' into chore/new-stripe-ui
BenKurrek Mar 24, 2024
c13de75
new modal grids and started adding max tickets per guest
BenKurrek Mar 24, 2024
f7a02fa
final changes for new ticket addition modal
BenKurrek Mar 24, 2024
6f17181
new UI and added max tickets per purchase
BenKurrek Mar 24, 2024
48be092
added limit per user to payload in event creation
BenKurrek Mar 24, 2024
d4aee1f
Merge pull request #235 from keypom/event-page-mobile-spacing
BenKurrek Mar 24, 2024
d1c9512
Merge pull request #237 from keypom/chore/new-stripe-ui
WAEliasmith Mar 24, 2024
fe78941
fixed undefined event metadata and eslint warns
WAEliasmith Mar 24, 2024
0bf176a
added limit per user for non free tickets
BenKurrek Mar 24, 2024
21c29a6
added free ticket purchases
BenKurrek Mar 24, 2024
c0fc0e4
build fix
BenKurrek Mar 24, 2024
8e746d9
hide limit warning if its not applicable, plus undefined limit fixes
WAEliasmith Mar 24, 2024
ac29f95
Merge pull request #239 from keypom/'gallery-bugfix'
minqianlu Mar 24, 2024
1332c6c
fix check types
WAEliasmith Mar 24, 2024
eff3023
Merge branch 'fydp' into feat/limit-per-user
WAEliasmith Mar 24, 2024
e1379f7
Merge pull request #241 from keypom/feat/limit-per-user
WAEliasmith Mar 24, 2024
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
Binary file modified .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'prettier',
'plugin:prettier/recommended',
],

overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand All @@ -33,6 +34,13 @@ module.exports = {
'@typescript-eslint',
],
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
endOfLine: 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-sort-props': [
2,
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.vcproj eol=lf
*.sh eol=lf
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"singleQuote": true,
"jsxSingleQuote": false,
"semi": true,
"printWidth": 100
"printWidth": 100,
"endOfLine": "auto"
}
9 changes: 2 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
// eslint extension options
"eslint.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
// prettier extension setting
"editor.formatOnSave": true,
"[javascript]": {
Expand All @@ -23,7 +18,7 @@
},
"editor.rulers": [80],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"cSpell.words": ["bgcolor"],
"typescript.tsdk": "node_modules/typescript/lib"
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"clean": "rm -rf dist .parcel-cache",
"dev": "yarn clean && yarn static && parcel src/index.html -p 3000",
"devwindows": "del dist && xcopy .\\public .\\dist /s /e /h /I && parcel src/index.html -p 3000",
"storybook": "yarn clean && yarn static && IS_STORYBOOK_VIEW=true parcel src/index.html -p 3000",
"dev-mainnet": "yarn clean && yarn static && REACT_APP_CONTRACT_ID=v2.keypom.near REACT_APP_NETWORK_ID=mainnet parcel src/index.html -p 3000",
"build": "yarn static && parcel build src/index.html --public-url ./ --no-cache --no-source-maps",
Expand Down Expand Up @@ -36,17 +37,21 @@
"idb-keyval": "^6.2.0",
"ipfs-car": "^0.9.2",
"keypom-js": "^1.4.7",
"luxon": "^3.4.4",
"mathjs": "^11.5.1",
"near-api-js": "^1.1.0",
"react": "^18.2.0",
"react-datepicker": "^6.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.0",
"react-input-mask": "^2.0.4",
"react-qr-code": "^2.0.11",
"react-qr-reader": "3.0.0-beta-1",
"react-qr-reader": "^3.0.0-beta-1",
"react-router-dom": "^6.8.0",
"rxjs": "^7.8.0",
"string_decoder": "^1.3.0",
"swr": "^2.0.3",
"tweetnacl-util": "^0.15.1",
"zod": "^3.20.2"
},
"devDependencies": {
Expand Down Expand Up @@ -83,9 +88,10 @@
"stream-browserify": "^3.0.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.9.5",
"util": "^0.12.3"
"util": "^0.12.3",
"vm-browserify": "^1.1.2"
},
"browserslist": [
"last 2 Chrome versions"
]
}
}
Binary file added public/assets/alcohol.webp
Binary file not shown.
Binary file added public/assets/purchase_with_stripe.webp
Binary file not shown.
Binary file added public/img/Ticket1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/Ticket2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/Ticket3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/alcohol.webp
Binary file not shown.
Binary file added public/img/ballet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/basketball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/car.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/friends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/hockeygame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/hockeyticket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/monalisa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/paintticket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RouterProvider } from 'react-router-dom';
import { ChakraProvider } from '@chakra-ui/react';

import { theme } from '@/theme';
import './components/DateRangePicker/DatePickerStyle.css'; // Path to your custom CSS
import { router } from '@/router';
import { router as storybookRouter } from '@/storybook-router';
import { Loading } from '@/components/Loading';
Expand Down
179 changes: 93 additions & 86 deletions src/components/AppModal/AppModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
Input,
Box,
Center,
Spinner,
Text,
ModalCloseButton,
ModalOverlay,
} from '@chakra-ui/react';
import { CheckIcon, CloseIcon } from '@chakra-ui/icons';

Expand All @@ -28,107 +28,114 @@ export const AppModal = () => {
const [values, setValues] = useState({});
const [loading, setLoading] = useState(false);

const canClose = appModal.canClose !== undefined ? appModal.canClose : true;
return (
<Modal
isCentered
closeOnOverlayClick={appModal.closeOnOverlayClick || false}
closeOnEsc={canClose}
closeOnOverlayClick={canClose && (appModal.closeOnOverlayClick || false)}
isOpen={appModal.isOpen}
size={appModal.size || 'md'}
onClose={() => {
setAppModal({
isOpen: false,
});
if (canClose) {
setAppModal({ isOpen: false });
}
}}
>
<ModalOverlay />
<ModalContent p={{ base: '8', md: '16' }} textAlign="center" top={'-10rem'}>
<ModalHeader
alignItems="center"
display="flex"
flexDir="column"
fontSize={{ base: 'xl', md: '2xl' }}
pb="0"
>
{appModal.header && <h4>{appModal.header}</h4>}
</ModalHeader>
{appModal.closeButtonVisible && <ModalCloseButton />}
<ModalBody>
{appModal.isLoading && (
<Center>
<Spinner
color="blue.400"
h={{ base: '16', md: '20' }}
mb="6"
w={{ base: '16', md: '20' }}
/>
</Center>
)}
<ModalOverlay backdropFilter="blur(0px)" bg="blackAlpha.600" opacity="1" />
{appModal.modalContent !== undefined ? (
appModal.modalContent
) : (
<ModalContent p={{ base: '4', md: '8' }} textAlign="center" top={'-5rem'}>
<ModalHeader
alignItems="center"
display="flex"
flexDir="column"
fontSize={{ base: 'xl', md: '2xl' }}
pb="0"
>
{appModal.header && <h4>{appModal.header}</h4>}
</ModalHeader>
{appModal.closeButtonVisible && <ModalCloseButton />}
<ModalBody>
{appModal.isLoading && (
<Center>
<Spinner
color="blue.400"
h={{ base: '16', md: '20' }}
mb="6"
w={{ base: '16', md: '20' }}
/>
</Center>
)}

{appModal.isSuccess && (
<Center>
<RoundIcon icon={<CheckIcon color="blue.400" />} mb="6" />
</Center>
)}
{appModal.isSuccess && (
<Center>
<RoundIcon icon={<CheckIcon color="blue.400" />} mb="6" />
</Center>
)}

{appModal.isError && (
<Center>
<RoundIcon icon={<CloseIcon color="blue.400" />} mb="6" />
</Center>
)}
{appModal.isError && (
<Center>
<RoundIcon icon={<CloseIcon color="blue.400" />} mb="6" />
</Center>
)}

{appModal.message && <Text my={2}>{appModal.message}</Text>}
{appModal.message && <Text my={2}>{appModal.message}</Text>}

{appModal.bodyComponent !== undefined && <Box>{appModal.bodyComponent}</Box>}
{appModal.bodyComponent !== undefined && <Box>{appModal.bodyComponent}</Box>}

{appModal.inputs && appModal.inputs.length > 0 && (
<>
{appModal.inputs.map(({ placeholder, valueKey }, i) => (
<Input
key={i}
placeholder={placeholder}
type="text"
onChange={(e) => {
setValues({
...values,
...{ [valueKey]: e.target.value },
});
}}
/>
))}
</>
)}
</ModalBody>
{appModal.inputs && appModal.inputs.length > 0 && (
<>
{appModal.inputs.map(({ placeholder, valueKey }, i) => (
<Input
key={i}
placeholder={placeholder}
type="text"
onChange={(e) => {
setValues({
...values,
...{ [valueKey]: e.target.value },
});
}}
/>
))}
</>
)}
</ModalBody>

{appModal.options && appModal.options.length > 0 && (
<ModalFooter>
<ButtonGroup justifyContent="center" w="full">
{appModal.options.map(({ label, func, buttonProps, lazy }, i) => (
<Button
key={i}
isLoading={loading}
onClick={async () => {
if (lazy) {
setAppModal({ isOpen: false });
{appModal.options && appModal.options.length > 0 && (
<ModalFooter>
<ButtonGroup justifyContent="space-between" w="full">
{appModal.options.map(({ label, func, buttonProps, lazy }, i) => (
<Button
key={i}
isLoading={loading}
onClick={async () => {
if (lazy) {
setAppModal({ isOpen: false });
if (func) {
await func(values);
}
return;
}
setLoading(true);
if (func) {
await func(values);
}
return;
}
setLoading(true);
if (func) {
await func(values);
}
setLoading(false);
setAppModal({ isOpen: false });
}}
{...buttonProps}
>
{label}
</Button>
))}
</ButtonGroup>
</ModalFooter>
)}
</ModalContent>
setLoading(false);
setAppModal({ isOpen: false });
}}
{...buttonProps}
>
{label}
</Button>
))}
</ButtonGroup>
</ModalFooter>
)}
</ModalContent>
)}
</Modal>
);
};
26 changes: 26 additions & 0 deletions src/components/AppModal/CompletionModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ModalContent, VStack, Text, Progress, Button } from '@chakra-ui/react';

interface CompletionModalContentProps {
onClose: () => void;
completionMessage?: string;
}

const CompletionModalContent = ({
onClose,
completionMessage = 'Deletion complete.',
}: CompletionModalContentProps) => (
<ModalContent padding={6}>
<VStack align="stretch" spacing={4}>
<Text fontSize="lg" fontWeight="semibold">
Deletion Complete
</Text>
<Progress hasStripe isAnimated value={100} />
<Text>{completionMessage}</Text>
<Button autoFocus={false} variant="secondary" width="full" onClick={onClose}>
Close
</Button>
</VStack>
</ModalContent>
);

export default CompletionModalContent;
32 changes: 32 additions & 0 deletions src/components/AppModal/ConfirmDeletionModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ModalContent, VStack, Text, HStack, Button } from '@chakra-ui/react';

interface ConfirmDeletionModalProps {
onConfirm: () => void;
onCancel: () => void;
confirmMessage?: string;
}

const ConfirmDeletionModal = ({
onConfirm,
onCancel,
confirmMessage = 'Are you sure you want to delete this item? This action cannot be undone.',
}: ConfirmDeletionModalProps) => (
<ModalContent padding={6}>
<VStack align="stretch" spacing={4}>
<Text fontSize="lg" fontWeight="semibold">
Confirm Deletion
</Text>
<Text>{confirmMessage}</Text>
<HStack justify="space-between">
<Button colorScheme="red" onClick={onConfirm}>
Delete
</Button>
<Button variant="ghost" onClick={onCancel}>
Cancel
</Button>
</HStack>
</VStack>
</ModalContent>
);

export default ConfirmDeletionModal;
Loading
Loading