-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow uploading a recording to an expired workspace (#10534)
- Loading branch information
Showing
7 changed files
with
100 additions
and
10 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
19 changes: 19 additions & 0 deletions
19
src/ui/components/UploadScreen/ExpiredWorkspaces.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,19 @@ | ||
.wrapper { | ||
position: absolute; | ||
top: -4rem; | ||
background-color: #fffbd2; | ||
color: #6e4400; | ||
border: 1px solid #f7ea9c; | ||
border-radius: 0.5rem; | ||
padding: 0.5rem 1rem; | ||
cursor: default; | ||
} | ||
|
||
.warning { | ||
font-weight: bold; | ||
} | ||
|
||
.wrapper a { | ||
margin-left: 0.3rem; | ||
text-decoration: underline; | ||
} |
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,41 @@ | ||
import { Workspace } from "shared/graphql/types"; | ||
import { useGetUserId } from "ui/hooks/users"; | ||
import { subscriptionExpired } from "ui/utils/workspace"; | ||
|
||
import styles from "./ExpiredWorkspaces.module.css"; | ||
|
||
export default function ExpiredWorkspaces({ workspaces }: { workspaces: Workspace[] }) { | ||
const { userId } = useGetUserId(); | ||
|
||
const expiredWorkspaces = workspaces.filter(workspace => subscriptionExpired(workspace)); | ||
|
||
if (expiredWorkspaces.length === 0) { | ||
return null; | ||
} | ||
|
||
const message = | ||
expiredWorkspaces.length === 1 | ||
? `The workspace "${expiredWorkspaces[0].name}" has expired.` | ||
: "Multiple workspaces have expired."; | ||
|
||
const expiredWorkspaceWithAdminRights = expiredWorkspaces.find(workspace => { | ||
const membership = workspace.members?.find(member => member.userId === userId); | ||
return membership?.roles?.includes("admin"); | ||
}); | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
<span className={styles.warning}>Warning: </span> | ||
{message} | ||
{expiredWorkspaceWithAdminRights && ( | ||
<a | ||
href={`/team/${expiredWorkspaceWithAdminRights.id}/settings/billing`} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Go to billing page | ||
</a> | ||
)} | ||
</div> | ||
); | ||
} |
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