-
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
remove-operator
- Loading branch information
Showing
7 changed files
with
150 additions
and
26 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
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
21 changes: 21 additions & 0 deletions
21
packages/connect-kit/src/scenes/for-dynamic-modal/remove-operator/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,21 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 12px; | ||
} | ||
|
||
.tips { | ||
margin: 0 0 12px; | ||
font-weight: 400; | ||
font-size: 14px; | ||
color: #49454f; | ||
text-align: center; | ||
} | ||
|
||
.item { | ||
height: 64px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-weight: 500; | ||
} |
58 changes: 58 additions & 0 deletions
58
packages/connect-kit/src/scenes/for-dynamic-modal/remove-operator/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,58 @@ | ||
import React from "react"; | ||
import { CharacterOperatorEntity } from "crossbell.js"; | ||
import { LoadingOverlay } from "@crossbell/ui"; | ||
|
||
import { useRemoveCharacterOperator } from "../../../hooks"; | ||
|
||
import { | ||
DynamicScenesContainer, | ||
DynamicScenesHeader, | ||
OptionList, | ||
OptionListItem, | ||
} from "../../../components"; | ||
|
||
import styles from "./index.module.css"; | ||
import { useRefCallback } from "@crossbell/util-hooks"; | ||
|
||
export type RemoveOperatorProps = { | ||
onSuccess: () => void; | ||
onCancel: () => void; | ||
characterOperator: CharacterOperatorEntity; | ||
}; | ||
|
||
export function RemoveOperator({ | ||
characterOperator, | ||
onSuccess, | ||
onCancel, | ||
}: RemoveOperatorProps) { | ||
const { isLoading, mutate } = useRemoveCharacterOperator({ onSuccess }); | ||
const remove = useRefCallback(() => mutate(characterOperator)); | ||
|
||
return ( | ||
<DynamicScenesContainer | ||
padding="10px 24px 24px" | ||
header={<DynamicScenesHeader title="Remove Operators" />} | ||
> | ||
<LoadingOverlay visible={isLoading} /> | ||
<div className={styles.container}> | ||
<p className={styles.tips}> | ||
Are you sure you would like to remove the operators? some functions | ||
might be affected. | ||
</p> | ||
|
||
<OptionList> | ||
<OptionListItem className={styles.item} color="red" onClick={remove}> | ||
Remove | ||
</OptionListItem> | ||
<OptionListItem | ||
className={styles.item} | ||
color="gray" | ||
onClick={onCancel} | ||
> | ||
Cancel | ||
</OptionListItem> | ||
</OptionList> | ||
</div> | ||
</DynamicScenesContainer> | ||
); | ||
} |
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