mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
* beginning ESM transition: Ceramic libraries, Next.js, & TypeScript configuration 🇭🇰 * updating Chakra, React, & Next image `import`s 👔 * upgrading `@types/react`, import extensions for Node, & b64 SVG to PNG ⛹🏿♀️ * fixing relative import names & upddating @types packages 📻 * removoing WYSIWYG editor, draft-js, & updating express ⛹🏿♀️ * updating OpenSea 🚲 * ¡@metafam/utils is building! 📰 * ¡Discord bot is building! 👘 * ¡backend is building! 🛩 * fixed everything but Ceramic DID update 🏍 * switching to DID:PKH 📦 * fixing "only one child allowed" error 🙇🏿♀️ * importing `React` as required by tsc's `isolatedModules` 🇲🇰 * disabling testing rather than taking the time to fix jest ⚜ * removing set `types` from `tsconfig` to fix compilation error 🥦 * printing tests disabled warning, hopefully 🙀 * setting file to be copied to the new resolver 👁️🗨️ * "paths-resolver" not "paths-resolve" 🦴 * switching back to relative paths rather than trying to fix `paths` ⏳ * `yarn backend:dev` not working, testing GitHub build 🎺 * removing design system build & fixing some images ✊🏿 * fixed "expected function got string" error & trying to address undefined HTMLElement 🐡 * fixing @emotion/react tree shaking by making external 🏏 * including eslint config in Dockerfile 🌾 * fixing more images 🎯 * updating DIDs & switching back to an updated DID:3 ❇ * switching to w3s.link gateway & fixing early termination of storage endpoint 🔭 * switching back to ipfs.io gateway b/c w3s.link serves SVGs as application/xml which are CORB blocked 🥾 * fixing node config name in eslint ignore & shortening some paths 🧰 * fixing ts-node not handling project references 🥁
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import {
|
||
Input,
|
||
InputGroup,
|
||
InputLeftElement,
|
||
InputRightAddon,
|
||
Text,
|
||
} from '@metafam/ds';
|
||
import React from 'react';
|
||
|
||
import { ProfileWizardPane } from './ProfileWizardPane';
|
||
import { WizardPaneCallbackProps } from './WizardPane';
|
||
|
||
export const SetupAvailability: React.FC = () => {
|
||
const field = 'availableHours';
|
||
|
||
return (
|
||
<ProfileWizardPane
|
||
{...{ field }}
|
||
title="Avail­ability"
|
||
prompt="What is your weekly availability for any kind of freelance work?"
|
||
>
|
||
{({ register, errored = false }: WizardPaneCallbackProps<number>) => {
|
||
const { ref: registerRef, ...props } = register(field, {
|
||
valueAsNumber: true,
|
||
min: {
|
||
value: 0,
|
||
message: 'It’s not possible to be available for negative time.',
|
||
},
|
||
max: {
|
||
value: 24 * 7,
|
||
message: `There’s only ${24 * 7} hours in a week.`,
|
||
},
|
||
});
|
||
|
||
return (
|
||
<InputGroup
|
||
mb={10}
|
||
maxW="10rem"
|
||
margin="auto"
|
||
borderColor="purple.700"
|
||
sx={{
|
||
':hover, :focus-within': {
|
||
borderColor: errored ? 'red' : 'white',
|
||
},
|
||
}}
|
||
>
|
||
<InputLeftElement>
|
||
<Text as="span" role="img" aria-label="clock">
|
||
🕛
|
||
</Text>
|
||
</InputLeftElement>
|
||
<Input
|
||
type="number"
|
||
placeholder="23…"
|
||
pl={9}
|
||
background="dark"
|
||
borderTopEndRadius={0}
|
||
borderBottomEndRadius={0}
|
||
borderRight={0}
|
||
_focus={errored ? { borderColor: 'red' } : undefined}
|
||
autoFocus
|
||
ref={(ref) => {
|
||
ref?.focus();
|
||
registerRef(ref);
|
||
}}
|
||
{...props}
|
||
/>
|
||
<InputRightAddon bg="purpleBoxDark" color="white">
|
||
<Text as="sup">hr</Text> ⁄ <Text as="sub">week</Text>
|
||
</InputRightAddon>
|
||
</InputGroup>
|
||
);
|
||
}}
|
||
</ProfileWizardPane>
|
||
);
|
||
};
|