Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 Settings / My Account {View} #3874

Merged
merged 151 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 150 commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
e5205ce
Fix breadcrumb colors
sean-brydon Jul 25, 2022
f2f075f
HorizontalTabs
sean-brydon Jul 25, 2022
dbd657c
Team List Item WIP
sean-brydon Jul 25, 2022
8fe290a
Merge remote-tracking branch 'origin/main' into V2-Components
sean-brydon Jul 26, 2022
1b6cb6b
Horizontal Tabs
sean-brydon Jul 26, 2022
104cd2e
Cards
sean-brydon Jul 26, 2022
193dd03
Remove team list item WIP
sean-brydon Jul 26, 2022
a0db67e
Merge branch 'main' into V2-Components
sean-brydon Jul 26, 2022
6677490
Login Page
sean-brydon Jul 26, 2022
02ab411
Add welcome back i118n
sean-brydon Jul 26, 2022
72c800d
EventType page work
sean-brydon Jul 26, 2022
8c81fcc
Update EventType Icons
sean-brydon Jul 26, 2022
79ff480
WIP Availability
sean-brydon Jul 27, 2022
c829830
Merge branch 'V2-Components' into feat/V2.0
sean-brydon Jul 27, 2022
b32ba65
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Jul 27, 2022
12d8f20
Horizontal Tab Work
sean-brydon Jul 27, 2022
b232ad8
Merge branch 'main' into feat/V2.0
sean-brydon Jul 27, 2022
b3935d5
Add build command for in root
sean-brydon Jul 27, 2022
a72671b
Update build DIr/command
sean-brydon Jul 27, 2022
d0ad652
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Jul 27, 2022
011db77
Add Edit Button + change buttons to v2
sean-brydon Jul 27, 2022
d78a53a
Availablitiy page
sean-brydon Jul 27, 2022
98f25d6
Fix IPAD
sean-brydon Jul 27, 2022
260d793
Make mobile look a little nicer
sean-brydon Jul 27, 2022
ac5837f
WIP bookingshell
sean-brydon Jul 27, 2022
c2228e4
Merge branch 'main' into feat/V2.0
sean-brydon Jul 27, 2022
28f1b25
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Jul 28, 2022
48ac5ec
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Jul 28, 2022
fff167d
Remove list items from breaking build
sean-brydon Jul 28, 2022
135c34c
Mian bulk of Booking Page.
sean-brydon Jul 28, 2022
70d40a3
Few updates to components
sean-brydon Jul 29, 2022
e6bbcbe
Fix chormatic feedback
sean-brydon Jul 29, 2022
d04798f
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 1, 2022
4f620f7
Fix banner
sean-brydon Aug 1, 2022
ee3aa72
Fix Empty Screen
sean-brydon Aug 1, 2022
9fb83bb
Text area + embded window fixes
sean-brydon Aug 1, 2022
a0c7a67
Semi fix avatar
sean-brydon Aug 1, 2022
dee1e4e
Troubleshoot container + Active on count
sean-brydon Aug 1, 2022
131b6b4
Merge branch 'main' into feat/V2.0
PeerRich Aug 1, 2022
b9cb152
Improve mobile
sean-brydon Aug 2, 2022
c906830
NITS
sean-brydon Aug 2, 2022
a1667fd
Fix padding on input
sean-brydon Aug 2, 2022
02c3e51
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 2, 2022
0fb768f
Fix icons
sean-brydon Aug 2, 2022
bac4dac
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 4, 2022
a2e5a73
Starting to move event types settings to tabs
sean-brydon Aug 4, 2022
b608b65
Begin migration to single page form
sean-brydon Aug 5, 2022
d2d82ea
Single page tabs
sean-brydon Aug 5, 2022
c8defae
Limits Page
sean-brydon Aug 6, 2022
3e3a2ea
Advanced tab
sean-brydon Aug 7, 2022
a534451
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 7, 2022
f214528
Add RHF to dependancies
sean-brydon Aug 7, 2022
784614f
Merge branch 'main' of https://github.com/calcom/cal.com into feat/V2.0
sean-brydon Aug 8, 2022
b251b75
Most of advanced tab
sean-brydon Aug 8, 2022
1be9a22
Merge branch 'main' of https://github.com/calcom/cal.com into feat/V2.0
sean-brydon Aug 8, 2022
e32adb4
Solved RHF mismtach
zomars Aug 8, 2022
867e9cb
Build fixes
zomars Aug 8, 2022
6e0b844
Merge branch 'main' into feat/V2.0
zomars Aug 8, 2022
8a179a1
RHF conditionals fixes
zomars Aug 8, 2022
077e795
Improved legibility
zomars Aug 8, 2022
b9ddc90
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 9, 2022
8f9e5f3
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 9, 2022
f264b41
Major refactor/organisation into optional V2 UI
sean-brydon Aug 10, 2022
fb9260f
Portal EditLocationModal
sean-brydon Aug 10, 2022
4795159
Fix dialoug form
sean-brydon Aug 10, 2022
033ffde
Update imports
sean-brydon Aug 10, 2022
e147c75
Auto Animate + custom inputs WIP
sean-brydon Aug 11, 2022
828d661
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 11, 2022
5049e63
Custom Inputs
sean-brydon Aug 11, 2022
4d336c8
WIP Apps
sean-brydon Aug 11, 2022
12c3372
Fixing stories imports
sean-brydon Aug 12, 2022
e2a55d4
Stripe app
sean-brydon Aug 12, 2022
a9ca2b9
Remove duplicate dialog
sean-brydon Aug 12, 2022
5d478c3
Remove duplicate dialog
sean-brydon Aug 12, 2022
5748eb5
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 12, 2022
e9213c5
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 12, 2022
d7b83a4
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 12, 2022
a73b9b9
Merge remote-tracking branch 'origin/main' into feat/v2.0
hariombalhara Aug 13, 2022
3f33afa
Merge remote-tracking branch 'origin/main' into feat/V2.0
hariombalhara Aug 13, 2022
0973830
Merge branch 'main' into feat/V2.0
sean-brydon Aug 15, 2022
4246300
Fix embed URL
sean-brydon Aug 15, 2022
a703f9a
Fix app toggles + number of active apps
sean-brydon Aug 15, 2022
c0deb23
Fix container padding on disabledBorder prop
sean-brydon Aug 15, 2022
0d5b432
Removes strict
sean-brydon Aug 15, 2022
1d4c4cf
EventType Team page WIP
sean-brydon Aug 16, 2022
e9e417e
Fix embed
hariombalhara Aug 16, 2022
ebcdeba
Merge remote-tracking branch 'origin/feat/V2.0' into feat/V2.0
hariombalhara Aug 16, 2022
6963070
NIT
sean-brydon Aug 16, 2022
e869f30
Add Darkmode gray color
sean-brydon Aug 16, 2022
8d387b9
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 16, 2022
850e5a6
V2 Shell WIP
sean-brydon Aug 16, 2022
ca172f4
Create my account folder
joeauyeung Aug 16, 2022
f2dbc14
Add profile section
joeauyeung Aug 16, 2022
53f9015
Fix headings on shell V2
sean-brydon Aug 17, 2022
efd1b04
Fix mobile layout with V2 shell
sean-brydon Aug 17, 2022
85b1fb3
V2 create event type button
sean-brydon Aug 17, 2022
1cf5f59
Checked Team Select
sean-brydon Aug 17, 2022
fccfa7d
Hidden to happen on save - not on toggle
sean-brydon Aug 17, 2022
9b1a825
Team Attendee Select animation
sean-brydon Aug 17, 2022
bf3d05f
WIP
joeauyeung Aug 17, 2022
140c5b6
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung Aug 17, 2022
5a36747
Fix scheduling type and remove multi select label
sean-brydon Aug 17, 2022
7ba1a07
Fix overflow on teams url
sean-brydon Aug 17, 2022
0dac841
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 17, 2022
06a11e7
Finish profile fields
joeauyeung Aug 17, 2022
114cd7e
Show toast on success
joeauyeung Aug 17, 2022
d0332c9
General tab WIP
joeauyeung Aug 17, 2022
8facf32
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 18, 2022
14f2e5f
Even Type move order handles
sean-brydon Aug 18, 2022
6b84f9e
Add switching of destination calendar
joeauyeung Aug 18, 2022
75ffe16
List calendar and delete
joeauyeung Aug 18, 2022
0466949
Render empty screenwhen no calendars
joeauyeung Aug 18, 2022
64619a2
Merge branch 'feat/V2.0' into v2/settings/my-account-view
PeerRich Aug 18, 2022
622bdda
Merge remote-tracking branch 'origin' into feat/V2.0
hariombalhara Aug 19, 2022
b7a0cfa
Fix Embed TS errors
hariombalhara Aug 19, 2022
5e9009f
Fix TS errors
hariombalhara Aug 19, 2022
93ea059
Fix Eslint errors
hariombalhara Aug 19, 2022
004a8c3
Fix TS errors for UI
hariombalhara Aug 19, 2022
e6af740
Fix ESLINT error
hariombalhara Aug 19, 2022
dbf7f84
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 21, 2022
63bb6b6
added SidebarCard for promo to v2 and storybook (#3906)
PeerRich Aug 21, 2022
1c3d354
Tooltip Provider - Wrapper due to dep upgrade
sean-brydon Aug 21, 2022
7e007fa
public event type list darkmode
sean-brydon Aug 22, 2022
cca4803
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung Aug 22, 2022
a8347c3
V2 Color changes to public booking
sean-brydon Aug 22, 2022
a723ad1
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon Aug 23, 2022
e86a104
Remove unused component
sean-brydon Aug 23, 2022
893a3f1
Fix typecheck
sean-brydon Aug 23, 2022
60ba462
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon Aug 23, 2022
28da0c1
Transfer to SSR
joeauyeung Aug 23, 2022
a1781bd
Appearance screen made
joeauyeung Aug 23, 2022
5c21054
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung Aug 23, 2022
b2da305
V2 image uploader
joeauyeung Aug 23, 2022
910e6cd
WIP appearance page
joeauyeung Aug 24, 2022
a3a4b27
Remove unnecessary data from viewer.me
joeauyeung Aug 24, 2022
164868a
Add profile translations
joeauyeung Aug 24, 2022
7924784
Add translations to general page
joeauyeung Aug 24, 2022
d4e7bb5
Add calendar switch
joeauyeung Aug 25, 2022
1eb52cf
Add calendar switch
joeauyeung Aug 25, 2022
97c9756
Add translations to appearance page
joeauyeung Aug 25, 2022
1f3ebc6
Clean up conferencing page
joeauyeung Aug 25, 2022
c3de0ca
Merge branch 'main' into v2/settings/my-account-view
joeauyeung Aug 25, 2022
4574054
Merge branch 'main' into v2/settings/my-account-view
zomars Aug 25, 2022
0829014
Settings sidebar fixes
zomars Aug 25, 2022
cefe6fc
Updates middleware
zomars Aug 25, 2022
703918d
Update SettingsLayout.tsx
zomars Aug 25, 2022
22694bf
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] Aug 25, 2022
2a03879
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] Aug 25, 2022
4d19a43
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] Aug 25, 2022
5f2348f
Settings layout improvements
zomars Aug 25, 2022
465cd57
Type fix
zomars Aug 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions apps/web/components/v2/settings/CalendarSwitch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { useMutation } from "react-query";

import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui";
import Badge from "@calcom/ui/v2/core/Badge";
import Switch from "@calcom/ui/v2/core/Switch";
import showToast from "@calcom/ui/v2/core/notfications";

export function CalendarSwitch(props: {
type: string;
externalId: string;
title: string;
defaultSelected: boolean;
}) {
const { t } = useLocale();

const utils = trpc.useContext();

const mutation = useMutation<
unknown,
unknown,
{
isOn: boolean;
}
>(
Comment on lines +20 to +26
Copy link
Member

Choose a reason for hiding this comment

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

Why we're taking this approach? Let's make this a tRPC mutation instead

async ({ isOn }) => {
const body = {
integration: props.type,
externalId: props.externalId,
};
if (isOn) {
const res = await fetch("/api/availability/calendar", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (!res.ok) {
throw new Error("Something went wrong");
}
} else {
const res = await fetch("/api/availability/calendar", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});

if (!res.ok) {
throw new Error("Something went wrong");
}
}
},
{
async onSettled() {
await utils.invalidateQueries(["viewer.integrations"]);
},
onError() {
showToast(`Something went wrong when toggling "${props.title}""`, "error");
},
}
);
return (
<div className="flex space-x-2 py-1">
<Switch
key={props.externalId}
name="enabled"
label={props.title}
defaultChecked={props.defaultSelected}
onCheckedChange={(isOn: boolean) => {
mutation.mutate({ isOn });
}}
/>
{props.defaultSelected && (
<Badge variant="gray">
<Icon.FiArrowLeft /> {t("adding_events_to")}
</Badge>
)}
</div>
);
}
169 changes: 169 additions & 0 deletions apps/web/components/v2/settings/ImageUploader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import { FormEvent, useCallback, useEffect, useState } from "react";
import Cropper from "react-easy-crop";

import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog";
import Button from "@calcom/ui/v2/core/Button";

import { Area, getCroppedImg } from "@lib/cropImage";
import { useFileReader } from "@lib/hooks/useFileReader";
import { useLocale } from "@lib/hooks/useLocale";

import Slider from "@components/Slider";

type ImageUploaderProps = {
id: string;
buttonMsg: string;
handleAvatarChange: (imageSrc: string) => void;
imageSrc?: string;
target: string;
};

interface FileEvent<T = Element> extends FormEvent<T> {
target: EventTarget & T;
}

// This is separate to prevent loading the component until file upload
function CropContainer({
onCropComplete,
imageSrc,
}: {
imageSrc: string;
onCropComplete: (croppedAreaPixels: Area) => void;
}) {
const { t } = useLocale();
const [crop, setCrop] = useState({ x: 0, y: 0 });
const [zoom, setZoom] = useState(1);

const handleZoomSliderChange = (value: number) => {
value < 1 ? setZoom(1) : setZoom(value);
};

return (
<div className="crop-container h-40 max-h-40 w-40 rounded-full">
<div className="relative h-40 w-40 rounded-full">
<Cropper
image={imageSrc}
crop={crop}
zoom={zoom}
aspect={1}
onCropChange={setCrop}
onCropComplete={(croppedArea, croppedAreaPixels) => onCropComplete(croppedAreaPixels)}
onZoomChange={setZoom}
/>
</div>
<Slider
value={zoom}
min={1}
max={3}
step={0.1}
label={t("slide_zoom_drag_instructions")}
changeHandler={handleZoomSliderChange}
/>
</div>
);
}

export default function ImageUploader({
target,
id,
buttonMsg,
handleAvatarChange,
...props
}: ImageUploaderProps) {
const { t } = useLocale();
const [imageSrc, setImageSrc] = useState<string | null>(null);
const [croppedAreaPixels, setCroppedAreaPixels] = useState<Area | null>(null);

const [{ result }, setFile] = useFileReader({
method: "readAsDataURL",
});

useEffect(() => {
if (props.imageSrc) setImageSrc(props.imageSrc);
}, [props.imageSrc]);

const onInputFile = (e: FileEvent<HTMLInputElement>) => {
if (!e.target.files?.length) {
return;
}
setFile(e.target.files[0]);
};

const showCroppedImage = useCallback(
async (croppedAreaPixels: Area | null) => {
try {
if (!croppedAreaPixels) return;
const croppedImage = await getCroppedImg(
result as string /* result is always string when using readAsDataUrl */,
croppedAreaPixels
);
setImageSrc(croppedImage);
handleAvatarChange(croppedImage);
} catch (e) {
console.error(e);
}
},
[result, handleAvatarChange]
);

return (
<Dialog
onOpenChange={
(opened) => !opened && setFile(null) // unset file on close
}>
<DialogTrigger asChild>
<div className="flex items-center">
<Button color="secondary" type="button" className="py-1 text-xs">
{buttonMsg}
</Button>
</div>
</DialogTrigger>
<DialogContent>
<div className="mb-4 sm:flex sm:items-start">
<div className="mt-3 text-center sm:mt-0 sm:text-left">
<h3 className="font-cal text-lg leading-6 text-gray-900" id="modal-title">
{t("upload_target", { target })}
</h3>
</div>
</div>
<div className="mb-4">
<div className="cropper mt-6 flex flex-col items-center justify-center p-8">
{!result && (
<div className="flex h-20 max-h-20 w-20 items-center justify-start rounded-full bg-gray-50">
{!imageSrc && (
<p className="w-full text-center text-sm text-white sm:text-xs">
{t("no_target", { target })}
</p>
)}
{imageSrc && (
// eslint-disable-next-line @next/next/no-img-element
<img className="h-20 w-20 rounded-full" src={imageSrc} alt={target} />
)}
</div>
)}
{result && <CropContainer imageSrc={result as string} onCropComplete={setCroppedAreaPixels} />}
<label className="mt-8 rounded-sm border border-gray-300 bg-white px-3 py-1 text-xs font-medium leading-4 text-gray-700 hover:bg-gray-50 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-1 dark:border-gray-800 dark:bg-transparent dark:text-white dark:hover:bg-gray-900">
<input
onInput={onInputFile}
type="file"
name={id}
placeholder={t("upload_image")}
className="pointer-events-none absolute mt-4 opacity-0"
accept="image/*"
/>
{t("choose_a_file")}
</label>
</div>
</div>
<div className="mt-5 gap-x-2 sm:mt-4 sm:flex sm:flex-row-reverse">
<DialogClose asChild>
<Button onClick={() => showCroppedImage(croppedAreaPixels)}>{t("save")}</Button>
</DialogClose>
<DialogClose asChild>
<Button color="secondary">{t("cancel")}</Button>
</DialogClose>
</div>
</DialogContent>
</Dialog>
);
}
8 changes: 7 additions & 1 deletion apps/web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { CONSOLE_URL, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
import { isIpInBanlist } from "@calcom/lib/getIP";
import { extendEventData, nextCollectBasicSettings } from "@calcom/lib/telemetry";

const V2_WHITELIST = ["/settings/admin", "/availability", "/bookings", "/event-types"];
const V2_WHITELIST = [
"/settings/admin",
"/settings/my-account",
Copy link
Member

Choose a reason for hiding this comment

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

Added

"/availability",
"/bookings",
"/event-types",
];

const middleware: NextMiddleware = async (req) => {
const url = req.nextUrl;
Expand Down
7 changes: 7 additions & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ const nextConfig = {
destination: "/settings/profile",
permanent: true,
},
/* V2 testers get redirected to the new settings */
{
source: "/settings/profile",
has: [{ type: "cookie", key: "calcom-v2-early-access" }],
destination: "/settings/my-account/profile",
permanent: false,
},
{
source: "/bookings",
destination: "/bookings/upcoming",
Expand Down
Loading