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

Staging => mian #173

Merged
merged 34 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
71c4cd2
new payout set function
M-Rb3 Jun 26, 2024
3510421
remove test
M-Rb3 Jun 26, 2024
b2e3327
Merge pull request #152 from PotLock/payout-update
M-Rb3 Jun 27, 2024
bf788b2
add payout description
M-Rb3 Jun 29, 2024
d2a6659
add payout description
M-Rb3 Jun 30, 2024
33e2724
Merge pull request #153 from PotLock/payout-update
M-Rb3 Jun 30, 2024
a5e505a
return the logs again
M-Rb3 Jul 1, 2024
814d4b9
Merge pull request #154 from PotLock/payout-update
M-Rb3 Jul 1, 2024
ba1a135
add error handling to fetch flagged address
M-Rb3 Jul 2, 2024
c7a4a18
Merge pull request #155 from PotLock/payout-update
M-Rb3 Jul 2, 2024
e1d3ec3
reduce donation limit
M-Rb3 Jul 5, 2024
eaeb110
make set payout only after challange period
M-Rb3 Jul 5, 2024
cdafcb3
Merge pull request #156 from PotLock/payout-update
M-Rb3 Jul 5, 2024
648b791
fix chllange payout button
M-Rb3 Jul 5, 2024
aafe601
Merge pull request #158 from PotLock/payout-update
M-Rb3 Jul 5, 2024
a901ca2
fix set payout now showing
M-Rb3 Jul 6, 2024
7ceb64c
Merge pull request #159 from PotLock:payout-update
M-Rb3 Jul 6, 2024
ea0b301
post payouts on chain
M-Rb3 Jul 9, 2024
d960c63
Merge pull request #160 from PotLock/payout-update
M-Rb3 Jul 9, 2024
92353ee
update
M-Rb3 Jul 10, 2024
2ff7217
Merge pull request #161 from PotLock:payout-update
M-Rb3 Jul 10, 2024
565fddf
handle error on payout
M-Rb3 Jul 14, 2024
b79f06b
Merge pull request #163 from PotLock/payout-update
M-Rb3 Jul 14, 2024
eae4f42
update set payout
M-Rb3 Jul 21, 2024
76aa5fb
Merge pull request #164 from PotLock/payout-update
M-Rb3 Jul 21, 2024
e40723e
fix multiple buttons issue on pot header
M-Rb3 Jul 21, 2024
d82c686
Merge pull request #165 from PotLock/payout-update
M-Rb3 Jul 21, 2024
80813dc
sort payout before setting it
M-Rb3 Jul 22, 2024
f10638e
Merge pull request #166 from PotLock/payout-update
M-Rb3 Jul 22, 2024
e335fbc
test Files component
wpdas Jul 30, 2024
4c2e264
fix upload image buttons for Profile component
wpdas Jul 30, 2024
e03b2c5
fix upload image buttons for Profile component
wpdas Jul 30, 2024
ce16b4d
removed unnecessary console log
wpdas Jul 30, 2024
03228b6
remove caret from upload image component
wpdas Jul 31, 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
3 changes: 3 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ type Props = {
stopPropagation?: boolean;
style?: React.CSSProperties;
target?: TargetValue;
key?: string;
iconSrc?: string;
children: string | React.ReactNode;
};

const Button = ({
key,
type,
varient,
name,
Expand Down Expand Up @@ -45,6 +47,7 @@ const Button = ({
style: style ?? {},
target: target,
...(href ? { href } : {}),
...(key ? { key } : {}),
...(name ? { name } : {}),
}}
>
Expand Down
4 changes: 2 additions & 2 deletions src/modals/ModalOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Props = {
overlayStyle?: React.CSSProperties;
};

const ModalOverlay = ({ children, onOverlayClick, contentStyle }: Props) => {
const ModalOverlay = ({ children, onOverlayClick, contentStyle, overlayStyle }: Props) => {
const ModalOverlay = styled.div`
position: fixed;
padding: 0 10px;
Expand Down Expand Up @@ -46,7 +46,7 @@ const ModalOverlay = ({ children, onOverlayClick, contentStyle }: Props) => {
`;

return (
<ModalOverlay style={contentStyle}>
<ModalOverlay style={overlayStyle}>
<Screen onClick={onOverlayClick} />
<ModalContent style={contentStyle}>{children}</ModalContent>
</ModalOverlay>
Expand Down
52 changes: 18 additions & 34 deletions src/pages/CreateProject/components/Profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Files, State, state } from "alem";
import CameraIcon from "@app/assets/svgs/CameraIcon";
import Button from "@app/components/Button";
import Image from "@app/components/mob.near/Image";
import constants from "@app/constants";
import uploadFileUpdateState from "../../utils/uploadFileUpdateState";
Expand Down Expand Up @@ -35,45 +34,30 @@ const Profile = () => {
<Container>
<BackgroundImage>
<Image image={backgroundImage} alt="profile background" fallbackUrl={IPFS_BASE_URL + fallbackImg} />
<Button type="standard" varient="outline" customClassName="btn-change-bg">
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
className="btn-change-bg"
clickable
onChange={handleBgChange}
>
<CameraIcon />
<span> Add cover photo</span>
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
style={{
zIndex: 1,
top: 0,
width: "100%",
height: "100%",
position: "absolute",
}}
clickable
onChange={handleBgChange}
/>
</Button>
</Files>
</BackgroundImage>
<ProfileImage>
<Image className="profile-image" image={profileImage} fallbackUrl={IPFS_BASE_URL + fallbackImg} />
<button className="btn-change-img">
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
className="btn-change-img"
clickable
onChange={handleImgChange}
>
<CameraIcon />
<Files
multiple={false}
accepts={["image/*"]}
minFileSize={1}
style={{
position: "absolute",
width: "100%",
height: "100%",
zIndex: 1,
left: 0,
top: 0,
}}
clickable
onChange={handleImgChange}
></Files>
</button>
</Files>
</ProfileImage>
</Container>
);
Expand Down
12 changes: 12 additions & 0 deletions src/pages/CreateProject/components/Profile/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const BackgroundImage = styled.div`
width: 100%;
border-radius: 6px;
background: var(--Neutral-200);
caret-color: transparent;
img {
width: 100%;
height: 100%;
Expand All @@ -25,9 +26,19 @@ export const BackgroundImage = styled.div`
line-height: 142%;
}
.btn-change-bg {
z-index: 10;
position: absolute;
bottom: 1.5rem;
right: 1.5rem;
background: white;
box-shadow: rgba(0, 0, 0, 0.22) 0px 0px 0px 1px inset, rgba(15, 15, 15, 0.15) 0px -1px 0px 0px inset,
rgba(5, 5, 5, 0.08) 0px 1px 2px -0.5px;
padding: 9px 16px;
display: flex;
gap: 8px;
border-radius: 6px;
transition: 200ms ease-in-out;
width: fit-content;
cursor: pointer;
svg {
width: 18px;
Expand All @@ -54,6 +65,7 @@ export const ProfileImage = styled.div`
border-radius: 50%;
background: var(--Neutral-200);
box-shadow: 0px 0px 0px 3px #fff, 0px 0px 0px 1px rgba(199, 199, 199, 0.22) inset;
caret-color: transparent;
img {
border-radius: 50%;
width: 100%;
Expand Down
22 changes: 15 additions & 7 deletions src/pages/Pot/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Header = () => {
const [potDetail, setPotDetail] = useState<null | PotDetail>(null);
const [allDonations, setAlldonations] = useState<null | PotDonation[]>(null);
const [payoutsToProcess, setPayoutsToProcess] = useState<any>(null);

// set fund mathcing pool success
const [fundDonation, setFundDonation] = useState<null | ExtendedFundDonation>(null);

Expand Down Expand Up @@ -145,10 +146,9 @@ const Header = () => {

const now = Date.now();

const cooldown_end_ms = _cooldown_end_ms ?? now + 1;
const cooldown_end_ms = _cooldown_end_ms ?? now + 1000;

const publicRoundOpen = now >= public_round_start_ms && now < public_round_end_ms;
const publicRoundEnded = now > public_round_end_ms;

const applicationOpen = now >= application_start_ms && now < application_end_ms;

Expand All @@ -158,9 +158,9 @@ const Header = () => {
context.accountId && `&referrerId=${context.accountId}`
}`;

const canPayoutsBeProcessed = userIsAdminOrGreater && now >= cooldown_end_ms && !all_paid_out;
const canPayoutsBeProcessed = userIsAdminOrGreater && cooldown_end_ms && !all_paid_out;

const canPayoutsBeSet = userIsChefOrGreater && !all_paid_out && publicRoundEnded;
const canPayoutsBeSet = userIsChefOrGreater && !all_paid_out && (now > cooldown_end_ms || !_cooldown_end_ms);

const payoutsChallenges = PotSDK.getPayoutsChallenges(potId);

Expand Down Expand Up @@ -237,13 +237,21 @@ const Header = () => {
{registrationApprovedOrNoRegistryProvider ? "Apply to pot" : `Project Registration ${registryStatus}`}
</Button>
)}
{now > public_round_end_ms && now < cooldown_end_ms && (
{now > public_round_end_ms && now < cooldown_end_ms && !!_cooldown_end_ms && (
<Button varient="tonal" onClick={() => setShowChallengePayoutsModal(true)}>
{existingChallengeForUser ? "Update challenge" : "Challenge payouts"}
</Button>
)}
{canPayoutsBeSet && <Button onClick={handleSetPayouts}> Set Payouts </Button>}
{canPayoutsBeProcessed && <Button onClick={handleProcessPayouts}>Process Payouts</Button>}
{canPayoutsBeSet && (
<Button key={"set-payout-btn"} onClick={handleSetPayouts}>
Set Payouts
</Button>
)}
{canPayoutsBeProcessed && (
<Button key={"process-payout-btn"} onClick={handleProcessPayouts}>
Process Payouts
</Button>
)}
</ButtonsWrapper>
<Referral>
<CopyIcon textToCopy={potLink} />
Expand Down
9 changes: 5 additions & 4 deletions src/pages/Pot/components/HeaderStatus/statsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ const statsList = (potDetail: PotDetail) => {
application_end_ms,
public_round_start_ms,
public_round_end_ms,
cooldown_end_ms,
cooldown_end_ms: _cooldown_end_ms,
all_paid_out,
} = potDetail;

const now = Date.now();
const cooldown_end_ms = _cooldown_end_ms ?? now + 1000;

const stats = [
{
Expand All @@ -31,11 +32,11 @@ const statsList = (potDetail: PotDetail) => {
},
{
label: "Challenge period",
daysLeft: cooldown_end_ms,
daysLeft: _cooldown_end_ms,
started: now >= public_round_end_ms,
completed: now > cooldown_end_ms && !!cooldown_end_ms,
completed: now > cooldown_end_ms && !!_cooldown_end_ms,
progress:
now > cooldown_end_ms && !!cooldown_end_ms
now > cooldown_end_ms && !!_cooldown_end_ms
? 1
: (cooldown_end_ms - now) / (public_round_end_ms - cooldown_end_ms),
},
Expand Down
Loading
Loading