af61b6d341
* feat: move bookings tabs to sidebar navigation - Add bookings sub-items (Upcoming, Unconfirmed, Recurring, Past, Cancelled) to sidebar navigation - Remove HorizontalTabs component from bookings view - Add redirect from /bookings to /bookings/upcoming for default navigation - Parent Bookings menu item now automatically navigates to Upcoming sub-item Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * clean up * add e2e tests * address feedback * add horizontal tab back * useBuildHref * update preserveQueryParams logic * put back lint rule --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
/**
|
|
* Provides a wrapper around localStorage to avoid errors in case of restricted storage access.
|
|
*
|
|
* TODO: In case of an embed if localStorage is not available(third party), use localStorage of parent(first party) that contains the iframe.
|
|
*/
|
|
export const localStorage = {
|
|
getItem(key: string) {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
return window.localStorage.getItem(key);
|
|
} catch {
|
|
// In case storage is restricted. Possible reasons
|
|
// 1. Third Party Context in Chrome Incognito mode.
|
|
return null;
|
|
}
|
|
},
|
|
setItem(key: string, value: string) {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
window.localStorage.setItem(key, value);
|
|
} catch {
|
|
// In case storage is restricted. Possible reasons
|
|
// 1. Third Party Context in Chrome Incognito mode.
|
|
// 2. Storage limit reached
|
|
return;
|
|
}
|
|
},
|
|
removeItem: (key: string) => {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
window.localStorage.removeItem(key);
|
|
} catch {
|
|
return;
|
|
}
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Provides a wrapper around localStorage to avoid errors in case of restricted storage access.
|
|
*
|
|
* TODO: In case of an embed if localStorage is not available(third party), use localStorage of parent(first party) that contains the iframe.
|
|
*/
|
|
export const sessionStorage = {
|
|
getItem(key: string) {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
return window.sessionStorage.getItem(key);
|
|
} catch {
|
|
// In case storage is restricted. Possible reasons
|
|
// 1. Third Party Context in Chrome Incognito mode.
|
|
return null;
|
|
}
|
|
},
|
|
setItem(key: string, value: string) {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
window.sessionStorage.setItem(key, value);
|
|
} catch {
|
|
// In case storage is restricted. Possible reasons
|
|
// 1. Third Party Context in Chrome Incognito mode.
|
|
// 2. Storage limit reached
|
|
return;
|
|
}
|
|
},
|
|
removeItem: (key: string) => {
|
|
try {
|
|
// eslint-disable-next-line @calcom/eslint/avoid-web-storage
|
|
window.sessionStorage.removeItem(key);
|
|
} catch {
|
|
return;
|
|
}
|
|
},
|
|
};
|