Skip to content

Commit

Permalink
feat: added workspace suspended component
Browse files Browse the repository at this point in the history
  • Loading branch information
vikrantgupta25 committed Nov 30, 2024
1 parent 5949d5d commit 0ecae48
Show file tree
Hide file tree
Showing 4 changed files with 351 additions and 1 deletion.
12 changes: 12 additions & 0 deletions frontend/public/locales/en-GB/failedPayment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"workspaceSuspended": "Your workspace is locked",
"gotQuestions": "Got Questions?",
"contactUs": "Contact Us",
"actionHeader": "Pay to continue",
"actionDescription": "Pay now to keep enjoying all the great features you’ve been using.",
"yourDataIsSafe": "Your data is safe with us until",
"actNow": "Act now to avoid any disruptions and continue where you left off.",
"contactAdmin": "Contact your admin to proceed with the upgrade.",
"continueMyJourney": "Settle your bill to continue",
"somethingWentWrong": "Something went wrong"
}
12 changes: 12 additions & 0 deletions frontend/public/locales/en/failedPayment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"workspaceSuspended": "Your workspace is locked",
"gotQuestions": "Got Questions?",
"contactUs": "Contact Us",
"actionHeader": "Pay to continue",
"actionDescription": "Pay now to keep enjoying all the great features you’ve been using.",
"yourDataIsSafe": "Your data is safe with us until",
"actNow": "Act now to avoid any disruptions and continue where you left off.",
"contactAdmin": "Contact your admin to proceed with the upgrade.",
"continueMyJourney": "Settle your bill to continue",
"somethingWentWrong": "Something went wrong"
}
179 changes: 179 additions & 0 deletions frontend/src/pages/WorkspaceSuspended/WorkspaceSuspended.styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
$light-theme: 'lightMode';
$dark-theme: 'darkMode';

@keyframes gradientFlow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}

.workspace-suspended {
&__modal {
.ant-modal-mask {
backdrop-filter: blur(2px);
}
}

&__tabs {
margin-top: 148px;

.ant-tabs {
&-nav {
&::before {
border-color: var(--bg-slate-500);

.#{$light-theme} & {
border-color: var(--bg-vanilla-300);
}
}
}
&-nav-wrap {
justify-content: center;
}
}
}

&__modal {
&__header {
display: flex;
justify-content: space-between;
align-items: center;

&__actions {
display: flex;
align-items: center;
gap: 16px;
}
}
.ant-modal-content {
border-radius: 4px;
border: 1px solid var(--bg-slate-400);
background: linear-gradient(
139deg,
rgba(18, 19, 23, 0.8) 0%,
rgba(18, 19, 23, 0.9) 98.68%
);
box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(20px);

.#{$light-theme} & {
border: 1px solid var(--bg-vanilla-300);
background: var(--bg-vanilla-100);
}
}

.ant-modal-header {
background: transparent;
}

.ant-list {
&-item {
border-color: var(--bg-slate-500);

.#{$light-theme} & {
border-color: var(--bg-vanilla-300);
}

&-meta {
align-items: center !important;

&-title {
margin-bottom: 0 !important;
}

&-avatar {
display: flex;
}
}
}
}
&__title {
font-weight: 400;
color: var(--text-vanilla-400);

.#{$light-theme} & {
color: var(--text-ink-200);
}
}
&__cta {
margin-top: 54px;
}
}
&__container {
padding-top: 64px;
}
&__details {
width: 80%;
margin: 0 auto;
color: var(--text-vanilla-400, #c0c1c3);
text-align: center;
font-size: 16px;
font-style: normal;
font-weight: 400;
line-height: 24px; /* 150% */

.#{$light-theme} & {
color: var(--text-ink-200);
}

&__highlight {
color: var(--text-vanilla-100, #fff);
font-style: normal;
font-weight: 700;
line-height: 24px;

.#{$light-theme} & {
color: var(--text-ink-100);
}
}
}
&__title {
background: linear-gradient(
99deg,
#ead8fd 0%,
#7a97fa 33%,
#fd5ab2 66%,
#ead8fd 100%
);
background-size: 300% 300%;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: gradientFlow 24s ease infinite;
margin-bottom: 18px;
}

&__faq-container {
width: 100%;

.ant-collapse,
.ant-collapse-item,
.ant-collapse-content-active {
.#{$dark-theme} & {
border-color: var(--bg-slate-400);
}
}
}

&__customer-stories {
&__left-container,
&__right-container {
display: flex;
flex-direction: column;
}

&__left-container {
align-items: flex-end;
}

&__right-container {
align-items: flex-start;
}
}
}
149 changes: 148 additions & 1 deletion frontend/src/pages/WorkspaceSuspended/WorkspaceSuspended.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,154 @@
import './WorkspaceSuspended.styles.scss';

import {
Alert,
Button,
Col,
Modal,
Row,
Skeleton,
Space,
Typography,
} from 'antd';
import updateCreditCardApi from 'api/billing/checkout';
import { useNotifications } from 'hooks/useNotifications';
import { useAppContext } from 'providers/App/App';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useMutation } from 'react-query';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
import AppReducer from 'types/reducer/app';
import { getFormattedDate } from 'utils/timeUtils';

function WorkspaceSuspended(): JSX.Element {
return <div>Workspace Suspended!</div>;
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
const isAdmin = role === 'ADMIN';
const { notifications } = useNotifications();
const { activeLicenseV3, isFetchingActiveLicenseV3 } = useAppContext();

const { t } = useTranslation(['failedPayment']);

const { mutate: updateCreditCard, isLoading } = useMutation(
updateCreditCardApi,
{
onSuccess: (data) => {
if (data.payload?.redirectURL) {
const newTab = document.createElement('a');
newTab.href = data.payload.redirectURL;
newTab.target = '_blank';
newTab.rel = 'noopener noreferrer';
newTab.click();
}
},
onError: () =>
notifications.error({
message: t('somethingWentWrong'),
}),
},
);

const handleUpdateCreditCard = useCallback(async () => {
updateCreditCard({
licenseKey: activeLicenseV3?.key || '',
successURL: window.location.origin,
cancelURL: window.location.origin,
});
}, [activeLicenseV3?.key, updateCreditCard]);
return (
<div>
<Modal
rootClassName="workspace-suspended__modal"
title={
<div className="workspace-suspended__modal__header">
<span className="workspace-suspended__modal__title">
{t('workspaceSuspended')}
</span>
<span className="workspace-suspended__modal__header__actions">
<Typography.Text className="workspace-suspended__modal__title">
Got Questions?
</Typography.Text>
<Button
type="default"
shape="round"
size="middle"
href="mailto:[email protected]"
role="button"
>
Contact Us
</Button>
</span>
</div>
}
open
closable={false}
footer={null}
width="65%"
>
<div className="workspace-suspended__container">
{isFetchingActiveLicenseV3 || !activeLicenseV3 ? (
<Skeleton />
) : (
<>
<Row justify="center" align="middle">
<Col>
<Space direction="vertical" align="center">
<Typography.Title level={2}>
<div className="workspace-suspended__title">{t('actionHeader')}</div>
</Typography.Title>
<Typography.Paragraph className="workspace-suspended__details">
{t('actionDescription')}
<br />
{t('yourDataIsSafe')}{' '}
<span className="workspace-suspended__details__highlight">
{getFormattedDate(Date.now())}
</span>{' '}
{t('actNow')}
</Typography.Paragraph>
</Space>
</Col>
</Row>
{!isAdmin && (
<Row
justify="center"
align="middle"
className="workspace-suspended__modal__cta"
gutter={[16, 16]}
>
<Col>
<Alert
message="Contact your admin to proceed with the upgrade."
type="info"
/>
</Col>
</Row>
)}
{isAdmin && (
<Row
justify="center"
align="middle"
className="workspace-suspended__modal__cta"
gutter={[16, 16]}
>
<Col>
<Button
type="primary"
shape="round"
size="middle"
loading={isLoading}
onClick={handleUpdateCreditCard}
>
{t('continueMyJourney')}
</Button>
</Col>
</Row>
)}
</>
)}
</div>
</Modal>
</div>
);
}

export default WorkspaceSuspended;

0 comments on commit 0ecae48

Please sign in to comment.