Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
enhancement: add workspace name on integration dashboard (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinsandilya authored Aug 14, 2023
1 parent 898c660 commit 7003ac6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "accounts" ADD COLUMN "workspaceName" TEXT;
1 change: 1 addition & 0 deletions packages/backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ model accounts {
public_token String @unique
domain String @unique @default("")
skipWaitlist Boolean @default(false)
workspaceName String?
users users[]
environments environments[]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ class AuthService {
try {
const userEmail = webhookData.email_addresses[0].email_address;
let userDomain = userEmail.split('@').pop();
let workspaceName = userDomain.charAt(0).toUpperCase() + userDomain.slice(1) + "'s Workspace";
if (!isWorkEmail(userEmail)) {
// make the personal email the unique domain.
workspaceName = 'Personal Workspace';
userDomain = userEmail;
}
// Create account only if an account does not exist for this user's domain.
Expand All @@ -207,6 +209,7 @@ class AuthService {
tenant_count: 0,
domain: userDomain,
skipWaitlist: false,
workspaceName: workspaceName,
environments: {
createMany: {
data: [
Expand Down
11 changes: 8 additions & 3 deletions packages/client/src/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const Home = () => {
.then((response) => response.json())
.then((result) => {
setAccount(result?.account);
const environments: string[] = result?.account?.environments?.map(env => env.env) || [];
const environments: string[] = result?.account?.environments?.map((env) => env.env) || [];
if (!environments.includes(DEFAULT_ENV)) {
setEnvironment(environments?.[0])
setEnvironment(environments?.[0]);
}
})
.catch((error) => {
Expand All @@ -59,7 +59,12 @@ const Home = () => {
};
return (
<>
<Navbar environment={environment} setEnvironment={setEnvironment} environmentList={account?.environments} />
<Navbar
workspaceName={account?.workspaceName}
environment={environment}
setEnvironment={setEnvironment}
environmentList={account?.environments}
/>
<div className="flex h-[100%]">
<div className="w-[20%] flex flex-col items-center pt-[120px] text-[#6e6e6e]">
<ul>
Expand Down
9 changes: 7 additions & 2 deletions packages/client/src/home/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import { Link } from 'react-router-dom';
import QuizIcon from '@mui/icons-material/Quiz';
import EnvironmentSelector from './environmentSelector';

const Navbar = ({ environment, setEnvironment, environmentList }) => {
const Navbar = ({ workspaceName, environment, setEnvironment, environmentList }) => {
return (
<div id="top-navbar">
<Link to="/" className="flex items-center">
<img src={Logo} alt="revert_logo" className="w-[30px] h-[30px] ml-[24px] cursor-pointer mt-4 mb-3" />
<img
src={Logo}
alt="revert_logo"
className="w-[30px] h-[30px] ml-[24px] cursor-pointer mt-4 mb-3 mr-[24px]"
/>
<span className="ml-[24px] mr-[12px]">{workspaceName}</span>
<EnvironmentSelector
environmentProp={environment}
setEnvironmentProp={setEnvironment}
Expand Down

1 comment on commit 7003ac6

@vercel
Copy link

@vercel vercel bot commented on 7003ac6 Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

revert-client – ./

app.revert.dev
revert-client-git-main-revertdev.vercel.app
revert-client-revertdev.vercel.app

Please sign in to comment.