PromucFlow_constructor/app/client/src/pages/AdminSettings/DisconnectService.tsx
Valera Melnikov 42debc6d11
chore: rename ADS package (#35583)
## Description
Rename `design-system` package to `@appsmith/ads`

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10319507327>
> Commit: 65d9664dd75b750496458a6e1652e0da858e1fc6
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10319507327&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 09 Aug 2024 13:47:50 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
2024-08-09 17:20:29 +03:00

58 lines
1.4 KiB
TypeScript

import React, { useState } from "react";
import styled from "styled-components";
import { Button, Callout, Text } from "@appsmith/ads";
import {
createMessage,
DANGER_ZONE,
DISCONNECT_AUTH_METHOD,
DISCONNECT_CONFIRMATION,
} from "ee/constants/messages";
export const Container = styled.div`
width: 100%;
padding: 16px 0;
> *:not(:first-child) {
margin: 8px 0;
}
`;
export function DisconnectService(props: {
disconnect: () => void;
subHeader: string;
warning: string;
}) {
const [warnDisconnectAuth, setWarnDisconnectAuth] = useState(false);
const [disconnectCalled, setDisconnectCalled] = useState(false);
const callDisconnect = () => {
if (!disconnectCalled) {
setDisconnectCalled(true);
props.disconnect();
}
};
return (
<Container>
<Text color="var(--ads-v2-color-fg-error)" kind="heading-l" renderAs="h2">
{createMessage(DANGER_ZONE)}
</Text>
<Text renderAs="h3">{props.subHeader}</Text>
<Callout kind="error">{props.warning}</Callout>
<Button
data-testid="disconnect-service-button"
isLoading={disconnectCalled}
kind="error"
onClick={() =>
warnDisconnectAuth ? callDisconnect() : setWarnDisconnectAuth(true)
}
size="md"
>
{warnDisconnectAuth
? createMessage(DISCONNECT_CONFIRMATION)
: createMessage(DISCONNECT_AUTH_METHOD)}
</Button>
</Container>
);
}