forked from benawad/dogehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
226f6a3
commit 4ad01bf
Showing
13 changed files
with
299 additions
and
307 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
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,21 @@ | ||
import * as React from "react"; | ||
|
||
function DeveloperIcon(props: React.SVGProps<SVGSVGElement>) { | ||
return ( | ||
<svg | ||
viewBox="0 0 21 21" | ||
width={16} | ||
height={16} | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<path | ||
d="M18.5 10H17V6C17 4.9 16.1 4 15 4H11V2.5C11 1.1 9.9 0 8.5 0C7.1 0 6 1.1 6 2.5V4H2C0.9 4 0 4.9 0 6V9.8H1.5C3 9.8 4.2 11 4.2 12.5C4.2 14 3 15.2 1.5 15.2H0V19C0 20.1 0.9 21 2 21H5.8V19.5C5.8 18 7 16.8 8.5 16.8C10 16.8 11.2 18 11.2 19.5V21H15C16.1 21 17 20.1 17 19V15H18.5C19.9 15 21 13.9 21 12.5C21 11.1 19.9 10 18.5 10Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
export default DeveloperIcon; |
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 |
---|---|---|
@@ -1,32 +1,24 @@ | ||
import React from "react"; | ||
import { Bot } from "./Bot"; | ||
|
||
interface BotIconProps { | ||
alt?: string; | ||
src: string; | ||
onClick: () => any; | ||
alt?: string; | ||
src: string; | ||
onClick: () => any; | ||
} | ||
|
||
export const BotIcon: React.FC<BotIconProps> = ({ alt, src, onClick }) => { | ||
return ( | ||
<div | ||
className="inline-block mb-2 grid" | ||
style={{ width: 120, height: 120 }} | ||
data-testid="single-user-avatar" | ||
> | ||
<img | ||
alt={alt} | ||
className={'rounded-full w-full h-full object-cover relative'} | ||
style={{ gridColumn: 1, gridRow: 1 }} | ||
src={src} | ||
/> | ||
<button | ||
className="flex justify-center items-center bg-primary-900 hover:opacity-40 transition duration-200 opacity-0 w-full h-full rounded-full" | ||
style={{ gridColumn: 1, gridRow: 1 }} | ||
onClick={onClick} | ||
> | ||
<div className="pointer-events-none">Edit Avatar</div> | ||
</button> | ||
</div> | ||
); | ||
return ( | ||
<div | ||
className="mb-2 grid" | ||
style={{ width: 120, height: 120 }} | ||
data-testid="single-user-avatar" | ||
> | ||
<img | ||
alt={alt} | ||
className={"rounded-full w-full h-full object-cover relative"} | ||
style={{ gridColumn: 1, gridRow: 1 }} | ||
src={src} | ||
/> | ||
</div> | ||
); | ||
}; |
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,84 @@ | ||
import { Form, Formik } from "formik"; | ||
import React from "react"; | ||
import { InputField } from "../../form-fields/InputField"; | ||
import { useWrappedConn } from "../../shared-hooks/useConn"; | ||
import { useTypeSafeTranslation } from "../../shared-hooks/useTypeSafeTranslation"; | ||
import { Button } from "../../ui/Button"; | ||
import { ButtonLink } from "../../ui/ButtonLink"; | ||
import { Modal } from "../../ui/Modal"; | ||
import { showErrorToast } from "../../lib/showErrorToast"; | ||
interface CreateBotModalProps { | ||
onRequestClose: () => void; | ||
data?: { | ||
username: string; | ||
}; | ||
} | ||
|
||
export const CreateBotModal: React.FC<CreateBotModalProps> = ({ | ||
onRequestClose, | ||
data, | ||
}) => { | ||
const { t } = useTypeSafeTranslation(); | ||
const wrapper = useWrappedConn(); | ||
|
||
return ( | ||
<Modal isOpen onRequestClose={onRequestClose}> | ||
<Formik<{ | ||
username: string; | ||
}> | ||
initialValues={ | ||
data | ||
? data | ||
: { | ||
username: "", | ||
} | ||
} | ||
validateOnChange={false} | ||
validateOnBlur={false} | ||
onSubmit={async ({ username }) => { | ||
wrapper.mutation.userCreateBot(username).then((r) => { | ||
if (r.isUsernameTaken) { | ||
showErrorToast( | ||
t("components.modals.createBotModal.usernameTaken") | ||
); | ||
} | ||
if (r.error) { | ||
showErrorToast(r.error); | ||
} | ||
}); | ||
onRequestClose(); | ||
}} | ||
> | ||
{({ isSubmitting }) => ( | ||
<Form className={`grid grid-cols-3 gap-4 focus:outline-none w-full`}> | ||
<div className={`col-span-3 block`}> | ||
<h4 className={`mb-2 text-primary-100`}> | ||
{t("components.modals.createBotModal.title")} | ||
</h4> | ||
<div className={`text-primary-300`}> | ||
{t("components.modals.createBotModal.subtitle")} | ||
</div> | ||
</div> | ||
<div className={`flex h-full w-full col-span-2`}> | ||
<InputField | ||
className={`mb-4`} | ||
errorMsg={t("components.modals.editProfileModal.usernameError")} | ||
label={t("components.modals.editProfileModal.usernameLabel")} | ||
name="username" | ||
/> | ||
</div> | ||
|
||
<div className={`flex pt-2 space-x-3 col-span-full items-center`}> | ||
<Button loading={isSubmitting} type="submit" className={`mr-3`}> | ||
{t("components.modals.createBotModal.title")} | ||
</Button> | ||
<ButtonLink type="button" onClick={onRequestClose}> | ||
{t("common.cancel")} | ||
</ButtonLink> | ||
</div> | ||
</Form> | ||
)} | ||
</Formik> | ||
</Modal> | ||
); | ||
}; |
Oops, something went wrong.