-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
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 f2f075f
HorizontalTabs
sean-brydon dbd657c
Team List Item WIP
sean-brydon 8fe290a
Merge remote-tracking branch 'origin/main' into V2-Components
sean-brydon 1b6cb6b
Horizontal Tabs
sean-brydon 104cd2e
Cards
sean-brydon 193dd03
Remove team list item WIP
sean-brydon a0db67e
Merge branch 'main' into V2-Components
sean-brydon 6677490
Login Page
sean-brydon 02ab411
Add welcome back i118n
sean-brydon 72c800d
EventType page work
sean-brydon 8c81fcc
Update EventType Icons
sean-brydon 79ff480
WIP Availability
sean-brydon c829830
Merge branch 'V2-Components' into feat/V2.0
sean-brydon b32ba65
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 12d8f20
Horizontal Tab Work
sean-brydon b232ad8
Merge branch 'main' into feat/V2.0
sean-brydon b3935d5
Add build command for in root
sean-brydon a72671b
Update build DIr/command
sean-brydon d0ad652
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 011db77
Add Edit Button + change buttons to v2
sean-brydon d78a53a
Availablitiy page
sean-brydon 98f25d6
Fix IPAD
sean-brydon 260d793
Make mobile look a little nicer
sean-brydon ac5837f
WIP bookingshell
sean-brydon c2228e4
Merge branch 'main' into feat/V2.0
sean-brydon 28f1b25
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 48ac5ec
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon fff167d
Remove list items from breaking build
sean-brydon 135c34c
Mian bulk of Booking Page.
sean-brydon 70d40a3
Few updates to components
sean-brydon e6bbcbe
Fix chormatic feedback
sean-brydon d04798f
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 4f620f7
Fix banner
sean-brydon ee3aa72
Fix Empty Screen
sean-brydon 9fb83bb
Text area + embded window fixes
sean-brydon a0c7a67
Semi fix avatar
sean-brydon dee1e4e
Troubleshoot container + Active on count
sean-brydon 131b6b4
Merge branch 'main' into feat/V2.0
PeerRich b9cb152
Improve mobile
sean-brydon c906830
NITS
sean-brydon a1667fd
Fix padding on input
sean-brydon 02c3e51
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 0fb768f
Fix icons
sean-brydon bac4dac
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon a2e5a73
Starting to move event types settings to tabs
sean-brydon b608b65
Begin migration to single page form
sean-brydon d2d82ea
Single page tabs
sean-brydon c8defae
Limits Page
sean-brydon 3e3a2ea
Advanced tab
sean-brydon a534451
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon f214528
Add RHF to dependancies
sean-brydon 784614f
Merge branch 'main' of https://github.com/calcom/cal.com into feat/V2.0
sean-brydon b251b75
Most of advanced tab
sean-brydon 1be9a22
Merge branch 'main' of https://github.com/calcom/cal.com into feat/V2.0
sean-brydon e32adb4
Solved RHF mismtach
zomars 867e9cb
Build fixes
zomars 6e0b844
Merge branch 'main' into feat/V2.0
zomars 8a179a1
RHF conditionals fixes
zomars 077e795
Improved legibility
zomars b9ddc90
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 8f9e5f3
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon f264b41
Major refactor/organisation into optional V2 UI
sean-brydon fb9260f
Portal EditLocationModal
sean-brydon 4795159
Fix dialoug form
sean-brydon 033ffde
Update imports
sean-brydon e147c75
Auto Animate + custom inputs WIP
sean-brydon 828d661
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 5049e63
Custom Inputs
sean-brydon 4d336c8
WIP Apps
sean-brydon 12c3372
Fixing stories imports
sean-brydon e2a55d4
Stripe app
sean-brydon a9ca2b9
Remove duplicate dialog
sean-brydon 5d478c3
Remove duplicate dialog
sean-brydon 5748eb5
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon e9213c5
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon d7b83a4
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon a73b9b9
Merge remote-tracking branch 'origin/main' into feat/v2.0
hariombalhara 3f33afa
Merge remote-tracking branch 'origin/main' into feat/V2.0
hariombalhara 0973830
Merge branch 'main' into feat/V2.0
sean-brydon 4246300
Fix embed URL
sean-brydon a703f9a
Fix app toggles + number of active apps
sean-brydon c0deb23
Fix container padding on disabledBorder prop
sean-brydon 0d5b432
Removes strict
sean-brydon 1d4c4cf
EventType Team page WIP
sean-brydon e9e417e
Fix embed
hariombalhara ebcdeba
Merge remote-tracking branch 'origin/feat/V2.0' into feat/V2.0
hariombalhara 6963070
NIT
sean-brydon e869f30
Add Darkmode gray color
sean-brydon 8d387b9
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 850e5a6
V2 Shell WIP
sean-brydon ca172f4
Create my account folder
joeauyeung f2dbc14
Add profile section
joeauyeung 53f9015
Fix headings on shell V2
sean-brydon efd1b04
Fix mobile layout with V2 shell
sean-brydon 85b1fb3
V2 create event type button
sean-brydon 1cf5f59
Checked Team Select
sean-brydon fccfa7d
Hidden to happen on save - not on toggle
sean-brydon 9b1a825
Team Attendee Select animation
sean-brydon bf3d05f
WIP
joeauyeung 140c5b6
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung 5a36747
Fix scheduling type and remove multi select label
sean-brydon 7ba1a07
Fix overflow on teams url
sean-brydon 0dac841
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 06a11e7
Finish profile fields
joeauyeung 114cd7e
Show toast on success
joeauyeung d0332c9
General tab WIP
joeauyeung 8facf32
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon 14f2e5f
Even Type move order handles
sean-brydon 6b84f9e
Add switching of destination calendar
joeauyeung 75ffe16
List calendar and delete
joeauyeung 0466949
Render empty screenwhen no calendars
joeauyeung 64619a2
Merge branch 'feat/V2.0' into v2/settings/my-account-view
PeerRich 622bdda
Merge remote-tracking branch 'origin' into feat/V2.0
hariombalhara b7a0cfa
Fix Embed TS errors
hariombalhara 5e9009f
Fix TS errors
hariombalhara 93ea059
Fix Eslint errors
hariombalhara 004a8c3
Fix TS errors for UI
hariombalhara e6af740
Fix ESLINT error
hariombalhara dbf7f84
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 63bb6b6
added SidebarCard for promo to v2 and storybook (#3906)
PeerRich 1c3d354
Tooltip Provider - Wrapper due to dep upgrade
sean-brydon 7e007fa
public event type list darkmode
sean-brydon cca4803
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung a8347c3
V2 Color changes to public booking
sean-brydon a723ad1
Merge remote-tracking branch 'origin/main' into feat/V2.0
sean-brydon e86a104
Remove unused component
sean-brydon 893a3f1
Fix typecheck
sean-brydon 60ba462
Merge branch 'feat/V2.0' of https://github.com/calcom/cal.com into fe…
sean-brydon 28da0c1
Transfer to SSR
joeauyeung a1781bd
Appearance screen made
joeauyeung 5c21054
Merge branch 'feat/V2.0' into v2/settings/my-account-view
joeauyeung b2da305
V2 image uploader
joeauyeung 910e6cd
WIP appearance page
joeauyeung a3a4b27
Remove unnecessary data from viewer.me
joeauyeung 164868a
Add profile translations
joeauyeung 7924784
Add translations to general page
joeauyeung d4e7bb5
Add calendar switch
joeauyeung 1eb52cf
Add calendar switch
joeauyeung 97c9756
Add translations to appearance page
joeauyeung 1f3ebc6
Clean up conferencing page
joeauyeung c3de0ca
Merge branch 'main' into v2/settings/my-account-view
joeauyeung 4574054
Merge branch 'main' into v2/settings/my-account-view
zomars 0829014
Settings sidebar fixes
zomars cefe6fc
Updates middleware
zomars 703918d
Update SettingsLayout.tsx
zomars 22694bf
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] 2a03879
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] 4d19a43
Merge branch 'main' into v2/settings/my-account-view
kodiakhq[bot] 5f2348f
Settings layout improvements
zomars 465cd57
Type fix
zomars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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; | ||
} | ||
>( | ||
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> | ||
); | ||
} |
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,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> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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