generated from bitbeckers/summon-raid-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from bitbeckers/fix/ui_tweaks_bugs
WIP: Fix/UI tweaks bugs
- Loading branch information
Showing
33 changed files
with
1,898 additions
and
224 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
import { HStack, Avatar, Text } from "@chakra-ui/react"; | ||
import { HStack, Avatar, Text, Button, useToast } from "@chakra-ui/react"; | ||
import { formatAddress, useENS } from "@raidguild/quiver"; | ||
|
||
export const ContributorRow: React.FC<{ address: string }> = ({ address }) => { | ||
const { address: _address, ens, avatar } = useENS({ address }); | ||
const toast = useToast(); | ||
|
||
const handleClick = () => { | ||
navigator.clipboard.writeText(address); | ||
toast({ | ||
title: `Copied address to clipboard`, | ||
status: "success", | ||
}); | ||
}; | ||
|
||
return ens ? ( | ||
<HStack> | ||
<Avatar name={ens} src={avatar} /> | ||
<Text>{ens}</Text> | ||
<Button variant={"link"} onClick={() => handleClick()}> | ||
<Text>{ens}</Text> | ||
</Button> | ||
</HStack> | ||
) : ( | ||
<HStack> | ||
<Avatar name={address} src={avatar} /> | ||
<Text>{formatAddress(address)}</Text> | ||
<Button variant={"link"} onClick={() => handleClick()}> | ||
<Text>{formatAddress(address)}</Text> | ||
</Button> | ||
</HStack> | ||
); | ||
}; |
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 { WorkstreamFragmentFragment } from "../../../.graphclient"; | ||
import { useResolveSoloWorkstream } from "../../../hooks/resolution"; | ||
import { ContributorRow } from "../ContributorRow"; | ||
import { | ||
Button, | ||
FormControl, | ||
Grid, | ||
GridItem, | ||
Text, | ||
VStack, | ||
useToast, | ||
} from "@chakra-ui/react"; | ||
import { useWallet } from "@raidguild/quiver"; | ||
import _ from "lodash"; | ||
import React, { Fragment } from "react"; | ||
import { useForm } from "react-hook-form"; | ||
|
||
const SoloResolutionForm: React.FC<{ | ||
workstream?: WorkstreamFragmentFragment; | ||
}> = ({ workstream }) => { | ||
if (!workstream) { | ||
<Text>Loading...</Text>; | ||
} | ||
|
||
const toast = useToast(); | ||
const { address: user } = useWallet(); | ||
|
||
const resolveSolo = useResolveSoloWorkstream(); | ||
|
||
const { | ||
handleSubmit, | ||
formState: { isSubmitting }, | ||
} = useForm({}); | ||
|
||
const onSubmit = () => { | ||
if ( | ||
workstream?.contributors?.length === 1 && | ||
workstream.contributors[0].user.id.toLowerCase() === | ||
user?.toLowerCase() && | ||
workstream?.id | ||
) { | ||
resolveSolo(Number(workstream.id)); | ||
} | ||
}; | ||
|
||
const contributors = workstream?.contributors; | ||
|
||
const reviewForm = | ||
contributors && contributors?.length > 0 && user ? ( | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<FormControl> | ||
<Grid gap={2} templateColumns="repeat(10, 1fr)"> | ||
<Fragment> | ||
<GridItem | ||
display={"flex"} | ||
alignItems={"center"} | ||
bg="#301A3A" | ||
colSpan={6} | ||
borderLeftRadius="3xl" | ||
> | ||
<ContributorRow address={contributors[0].user.id} /> | ||
</GridItem> | ||
<GridItem | ||
display={"flex"} | ||
alignItems={"center"} | ||
justifyContent={"center"} | ||
colSpan={3} | ||
> | ||
<Button h={"100%"} isLoading={isSubmitting} type="submit"> | ||
Close workstream | ||
</Button> | ||
</GridItem> | ||
</Fragment> | ||
</Grid> | ||
</FormControl> | ||
|
||
<VStack w={"100%"} pt={4}> | ||
<Text paddingBottom={"2em"} paddingTop={"2em"} textAlign={"center"}> | ||
You are the sole contributor. | ||
</Text> | ||
</VStack> | ||
</form> | ||
) : ( | ||
<Text>No contributors found</Text> | ||
); | ||
|
||
return reviewForm; | ||
}; | ||
|
||
export { SoloResolutionForm }; |
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
Oops, something went wrong.
8746a57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
fux-dapp-app-gcry – ./
fux-dapp-app-gcry-bitbeckers.vercel.app
fux-dapp-app-gcry-git-main-bitbeckers.vercel.app
fux-dapp-app-gcry.vercel.app