Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit41fe259

Browse files
committed
organization brand customistaion
1 parent3ff98fe commit41fe259

File tree

14 files changed

+1098
-692
lines changed

14 files changed

+1098
-692
lines changed

‎apps/web/app/(use-page-wrapper)/onboarding/organization/brand/page.tsx‎renamed to ‎apps/web/app/(use-page-wrapper)/onboarding/organization/invite/email/page.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import{createRouterCaller}from"app/_trpc/context";
21
import{_generateMetadata}from"app/_utils";
32
import{cookies,headers}from"next/headers";
43
import{redirect}from"next/navigation";
@@ -8,15 +7,15 @@ import { APP_NAME } from "@calcom/lib/constants";
87

98
import{buildLegacyRequest}from"@lib/buildLegacyCtx";
109

11-
import{OrganizationBrandView}from"~/onboarding/organization/brand/organization-brand-view";
10+
import{OrganizationInviteEmailView}from"~/onboarding/organization/invite/email/organization-invite-email-view";
1211

1312
exportconstgenerateMetadata=async()=>{
1413
returnawait_generateMetadata(
15-
(t)=>`${APP_NAME} -${t("organization_brand")}`,
14+
(t)=>`${APP_NAME} -${t("invite_teammates")}`,
1615
()=>"",
1716
true,
1817
undefined,
19-
"/onboarding/organization/brand"
18+
"/onboarding/organization/invite/email"
2019
);
2120
};
2221

@@ -29,7 +28,8 @@ const ServerPage = async () => {
2928

3029
constuserEmail=session.user.email||"";
3130

32-
return<OrganizationBrandViewuserEmail={userEmail}/>;
31+
return<OrganizationInviteEmailViewuserEmail={userEmail}/>;
3332
};
3433

3534
exportdefaultServerPage;
35+
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
"use client";
2+
3+
import{useForm,useFieldArray,typeUseFormReturn}from"react-hook-form";
4+
5+
import{useLocale}from"@calcom/lib/hooks/useLocale";
6+
import{Button}from"@calcom/ui/components/button";
7+
import{Form,Label,TextField,Select}from"@calcom/ui/components/form";
8+
import{Icon}from"@calcom/ui/components/icon";
9+
10+
importtype{InviteRole}from"../store/onboarding-store";
11+
12+
typeInviteFormData={
13+
email:string;
14+
team?:string;
15+
role:InviteRole;
16+
};
17+
18+
typeEmailInviteFormProps={
19+
form:UseFormReturn<{invites:InviteFormData[]}>;
20+
fields:Array<{id:string}>;
21+
append:(value:InviteFormData)=>void;
22+
remove:(index:number)=>void;
23+
defaultRole:InviteRole;
24+
showTeamSelect?:boolean;
25+
teams?:Array<{value:string;label:string}>;
26+
emailPlaceholder?:string;
27+
};
28+
29+
exportconstEmailInviteForm=({
30+
form,
31+
fields,
32+
append,
33+
remove,
34+
defaultRole,
35+
showTeamSelect=false,
36+
teams=[],
37+
emailPlaceholder,
38+
}:EmailInviteFormProps)=>{
39+
const{ t}=useLocale();
40+
41+
return(
42+
<divclassName="flex w-full flex-col gap-4">
43+
<divclassName="flex flex-col gap-2">
44+
{showTeamSelect ?(
45+
<divclassName="grid grid-cols-2">
46+
<LabelclassName="text-emphasis mb-0 text-sm font-medium"htmlFor="invites.0.email">
47+
{t("email")}
48+
</Label>
49+
<LabelclassName="text-emphasis mb-0 text-sm font-medium"htmlFor="invites.0.team">
50+
{t("team")}
51+
</Label>
52+
</div>
53+
) :(
54+
<LabelclassName="text-emphasis text-sm font-medium">{t("email")}</Label>
55+
)}
56+
57+
<div
58+
className={
59+
showTeamSelect ?"flex flex-col gap-2" :"scroll-bar flex max-h-72 flex-col gap-2 overflow-y-auto"
60+
}>
61+
{fields.map((field,index)=>(
62+
<divkey={field.id}className="flex items-start gap-0.5">
63+
<divclassName={showTeamSelect ?"grid flex-1 items-start gap-2 md:grid-cols-2" :"flex-1"}>
64+
<TextField
65+
labelSrOnly
66+
{...form.register(`invites.${index}.email`)}
67+
placeholder={emailPlaceholder||`rick@cal.com`}
68+
type="email"
69+
size="sm"
70+
/>
71+
{showTeamSelect&&(
72+
<Select
73+
size="sm"
74+
options={teams}
75+
value={teams.find((t)=>t.value===form.watch(`invites.${index}.team`))}
76+
onChange={(option)=>{
77+
if(option){
78+
form.setValue(`invites.${index}.team`,option.value);
79+
}
80+
}}
81+
placeholder={t("select_team")}
82+
/>
83+
)}
84+
</div>
85+
<Button
86+
type="button"
87+
color="minimal"
88+
variant="icon"
89+
size="sm"
90+
className="h-7 w-7"
91+
disabled={fields.length===1}
92+
onClick={()=>remove(index)}>
93+
<Iconname="x"className="h-4 w-4"/>
94+
</Button>
95+
</div>
96+
))}
97+
</div>
98+
99+
<Button
100+
type="button"
101+
color="secondary"
102+
size="sm"
103+
StartIcon="plus"
104+
className={showTeamSelect ?"mt-2 w-fit" :"w-fit"}
105+
onClick={()=>append({email:"",team:showTeamSelect ?"" :undefined,role:defaultRole})}>
106+
{t("add")}
107+
</Button>
108+
</div>
109+
</div>
110+
);
111+
};
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"use client";
2+
3+
import{useFlags}from"@calcom/features/flags/hooks";
4+
import{useLocale}from"@calcom/lib/hooks/useLocale";
5+
import{Button}from"@calcom/ui/components/button";
6+
import{Icon}from"@calcom/ui/components/icon";
7+
8+
typeInviteOptionsProps={
9+
onInviteViaEmail:()=>void;
10+
onUploadCSV?:()=>void;
11+
onCopyInviteLink?:()=>void;
12+
onConnectGoogleWorkspace?:()=>void;
13+
isSubmitting?:boolean;
14+
};
15+
16+
exportconstInviteOptions=({
17+
onInviteViaEmail,
18+
onUploadCSV,
19+
onCopyInviteLink,
20+
onConnectGoogleWorkspace,
21+
isSubmitting=false,
22+
}:InviteOptionsProps)=>{
23+
const{ t}=useLocale();
24+
constflags=useFlags();
25+
constgoogleWorkspaceEnabled=flags["google-workspace-directory"];
26+
27+
return(
28+
<divclassName="flex w-full flex-col gap-6 px-5">
29+
{googleWorkspaceEnabled&&onConnectGoogleWorkspace&&(
30+
<>
31+
<Button
32+
color="secondary"
33+
className="h-8 w-full rounded-[10px]"
34+
StartIcon="google"
35+
onClick={onConnectGoogleWorkspace}
36+
disabled={isSubmitting}>
37+
{t("connect_google_workspace")}
38+
</Button>
39+
40+
<divclassName="flex w-full items-center gap-2">
41+
<divclassName="border-subtle h-px flex-1 border-t"/>
42+
<spanclassName="text-subtle text-sm font-medium">{t("or")}</span>
43+
<divclassName="border-subtle h-px flex-1 border-t"/>
44+
</div>
45+
</>
46+
)}
47+
48+
<divclassName="flex w-full flex-col gap-4">
49+
<Button
50+
color="secondary"
51+
className="h-8 w-full justify-center rounded-[10px]"
52+
onClick={onInviteViaEmail}
53+
disabled={isSubmitting}>
54+
<divclassName="flex items-center gap-1">
55+
<Iconname="mail"className="h-4 w-4"/>
56+
<span>{t("invite_via_email")}</span>
57+
</div>
58+
</Button>
59+
60+
{onUploadCSV&&(
61+
<Button
62+
color="secondary"
63+
className="h-8 w-full justify-center rounded-[10px]"
64+
onClick={onUploadCSV}
65+
disabled={isSubmitting}>
66+
<divclassName="flex items-center gap-1">
67+
<Iconname="upload"className="h-4 w-4"/>
68+
<span>{t("upload_csv_file")}</span>
69+
</div>
70+
</Button>
71+
)}
72+
73+
{onCopyInviteLink&&(
74+
<Button
75+
color="secondary"
76+
className="h-8 w-full justify-center rounded-[10px]"
77+
onClick={onCopyInviteLink}
78+
disabled>
79+
<divclassName="flex items-center gap-1">
80+
<Iconname="link"className="h-4 w-4"/>
81+
<span>{t("copy_invite_link")}</span>
82+
</div>
83+
</Button>
84+
)}
85+
</div>
86+
</div>
87+
);
88+
};
89+

‎apps/web/modules/onboarding/components/OnboardingCard.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const OnboardingCard = ({ title, subtitle, children, footer, isLoading }:
1414
return(
1515
<divclassName="relative flex h-full min-h-0 w-full flex-col">
1616
{/* Card Header */}
17-
<divclassName="flex w-full gap-1.5 px-5 py-4">
17+
<divclassName="flex w-full gap-1.5 px-1 py-4">
1818
<divclassName="flex w-full flex-col gap-1">
1919
<h1className="font-cal text-xl font-semibold leading-6">{title}</h1>
2020
<pclassName="text-subtle text-sm font-medium leading-tight">{subtitle}</p>
@@ -38,4 +38,3 @@ export const OnboardingCard = ({ title, subtitle, children, footer, isLoading }:
3838
</div>
3939
);
4040
};
41-
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"use client";
2+
3+
import{useLocale}from"@calcom/lib/hooks/useLocale";
4+
import{ToggleGroup}from"@calcom/ui/components/form";
5+
import{InfoBadge}from"@calcom/ui/components/badge";
6+
7+
importtype{InviteRole}from"../store/onboarding-store";
8+
9+
typeRoleSelectorProps={
10+
value:InviteRole;
11+
onValueChange:(value:InviteRole)=>void;
12+
showInfoBadge?:boolean;
13+
};
14+
15+
exportconstRoleSelector=({ value, onValueChange, showInfoBadge=false}:RoleSelectorProps)=>{
16+
const{ t}=useLocale();
17+
18+
return(
19+
<divclassName="flex items-center justify-between">
20+
<divclassName="hidden items-center gap-2 md:flex">
21+
<spanclassName="text-emphasis text-sm">{t("onboarding_invite_all_as")}</span>
22+
<ToggleGroup
23+
value={value}
24+
onValueChange={(val)=>val&&onValueChange(valasInviteRole)}
25+
options={[
26+
{value:"MEMBER",label:t("members")},
27+
{value:"ADMIN",label:t("onboarding_admins")},
28+
]}
29+
/>
30+
{showInfoBadge&&<InfoBadgecontent={t("onboarding_modify_roles_later")}/>}
31+
</div>
32+
{!showInfoBadge&&(
33+
<spanclassName="text-subtle text-sm">{t("onboarding_modify_roles_later")}</span>
34+
)}
35+
</div>
36+
);
37+
};
38+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp