-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connect-kit/x-settings): add
operator-detail
- Loading branch information
Showing
16 changed files
with
469 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,8 @@ | |
color: #fff; | ||
background: #6ad991; | ||
} | ||
|
||
.red { | ||
color: #fff; | ||
background: #e65040; | ||
} |
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
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
3 changes: 3 additions & 0 deletions
3
packages/connect-kit/src/scenes/for-dynamic-modal/operator-detail/index.module.css
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,3 @@ | ||
.mainBtn { | ||
margin-top: 48px; | ||
} |
77 changes: 77 additions & 0 deletions
77
packages/connect-kit/src/scenes/for-dynamic-modal/operator-detail/index.tsx
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,77 @@ | ||
import React from "react"; | ||
import { useRefCallback } from "@crossbell/util-hooks"; | ||
import { truncateAddress } from "@crossbell/util-ethers"; | ||
|
||
import { | ||
DynamicScenesContainer, | ||
DynamicScenesHeader, | ||
MainBtn, | ||
useDynamicScenesModal, | ||
} from "../../../components"; | ||
|
||
import { OperatorCard } from "./operator-card"; | ||
import { RemoveOperator } from "../remove-operator"; | ||
|
||
import styles from "./index.module.css"; | ||
import { PermissionList } from "./permission-list"; | ||
|
||
export type OperatorDetailProps = React.ComponentProps<typeof OperatorCard>; | ||
|
||
export function OperatorDetail({ | ||
characterOperator, | ||
description, | ||
characterId, | ||
tags, | ||
}: OperatorDetailProps) { | ||
const { goTo, goBack } = useDynamicScenesModal(); | ||
|
||
const goToRemoveOperator = useRefCallback((event: React.MouseEvent) => { | ||
event.stopPropagation(); | ||
goTo({ | ||
kind: "remove-operator", | ||
Component: () => ( | ||
<RemoveOperator | ||
characterOperator={characterOperator} | ||
onSuccess={() => { | ||
goBack(); | ||
goBack(); | ||
}} | ||
onCancel={goBack} | ||
/> | ||
), | ||
}); | ||
}); | ||
return ( | ||
<DynamicScenesContainer | ||
padding="10px 24px 24px" | ||
header={ | ||
<DynamicScenesHeader | ||
title={truncateAddress(characterOperator.operator, { | ||
start: 4, | ||
end: 4, | ||
})} | ||
/> | ||
} | ||
> | ||
<OperatorCard | ||
tags={tags} | ||
characterOperator={characterOperator} | ||
description={description} | ||
characterId={characterId} | ||
/> | ||
|
||
<PermissionList | ||
characterId={characterId} | ||
characterOperator={characterOperator} | ||
/> | ||
|
||
<MainBtn | ||
onClick={goToRemoveOperator} | ||
color="red" | ||
className={styles.mainBtn} | ||
> | ||
Remove Operator | ||
</MainBtn> | ||
</DynamicScenesContainer> | ||
); | ||
} |
Oops, something went wrong.