feat: hide the update button in case of no permission (#17883)
* feat: hide button if not owner of org * fix
This commit is contained in:
1 parent
ab9b6024bb
commit
d6fe955ea8
2 files changed
+15
-13
No files matched your search
@@ -46,7 +46,6 @@
|
|||||||
"event_request_reassigned": "Your scheduled event was reassigned",
|
"event_request_reassigned": "Your scheduled event was reassigned",
|
||||||
"event_reassigned_subtitle": "You will no longer have the event on your calendar and your round robin likelihood will not be negatively impacted",
|
"event_reassigned_subtitle": "You will no longer have the event on your calendar and your round robin likelihood will not be negatively impacted",
|
||||||
"organizer": "Organizer",
|
"organizer": "Organizer",
|
||||||
"owner_permission_needed": "You need to be an owner of the organization.",
|
|
||||||
"reassigned_to": "Reassigned to",
|
"reassigned_to": "Reassigned to",
|
||||||
"need_to_reschedule_or_cancel": "Need to reschedule or cancel?",
|
"need_to_reschedule_or_cancel": "Need to reschedule or cancel?",
|
||||||
"you_can_view_booking_details_with_this_url": "You can view the booking details from this url {{url}} and add the event to your calendar",
|
"you_can_view_booking_details_with_this_url": "You can view the booking details from this url {{url}} and add the event to your calendar",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Controller, useForm } from "react-hook-form";
|
|||||||
|
|
||||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||||
import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";
|
import SectionBottomActions from "@calcom/features/settings/SectionBottomActions";
|
||||||
|
import { classNames } from "@calcom/lib";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { nameOfDay } from "@calcom/lib/weekday";
|
import { nameOfDay } from "@calcom/lib/weekday";
|
||||||
import { MembershipRole } from "@calcom/prisma/enums";
|
import { MembershipRole } from "@calcom/prisma/enums";
|
||||||
@@ -27,7 +28,7 @@ import {
|
|||||||
import { LockEventTypeSwitch } from "../components/LockEventTypeSwitch";
|
import { LockEventTypeSwitch } from "../components/LockEventTypeSwitch";
|
||||||
import { NoSlotsNotificationSwitch } from "../components/NoSlotsNotificationSwitch";
|
import { NoSlotsNotificationSwitch } from "../components/NoSlotsNotificationSwitch";
|
||||||
|
|
||||||
const SkeletonLoader = ({ title, description }: { title: string; description: string }) => {
|
const SkeletonLoader = () => {
|
||||||
return (
|
return (
|
||||||
<SkeletonContainer>
|
<SkeletonContainer>
|
||||||
<div className="mb-8 mt-6 space-y-6">
|
<div className="mb-8 mt-6 space-y-6">
|
||||||
@@ -70,7 +71,7 @@ const OrgGeneralView = () => {
|
|||||||
[error]
|
[error]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isPending) return <SkeletonLoader title={t("general")} description={t("general_description")} />;
|
if (isPending) return <SkeletonLoader />;
|
||||||
if (!currentOrg) {
|
if (!currentOrg) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -149,7 +150,11 @@ const GeneralView = ({ currentOrg, isAdminOrOwner, localeProp }: GeneralViewProp
|
|||||||
weekStart: values.weekStart.value,
|
weekStart: values.weekStart.value,
|
||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
<div className="border-subtle border-x border-y-0 px-4 py-8 sm:px-6">
|
<div
|
||||||
|
className={classNames(
|
||||||
|
"border-subtle border-x border-y-0 px-4 py-8 sm:px-6",
|
||||||
|
!isAdminOrOwner && "rounded-b-lg border-y"
|
||||||
|
)}>
|
||||||
<Controller
|
<Controller
|
||||||
name="timeZone"
|
name="timeZone"
|
||||||
control={formMethods.control}
|
control={formMethods.control}
|
||||||
@@ -209,15 +214,13 @@ const GeneralView = ({ currentOrg, isAdminOrOwner, localeProp }: GeneralViewProp
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SectionBottomActions align="end">
|
{isAdminOrOwner && (
|
||||||
<Button
|
<SectionBottomActions align="end">
|
||||||
disabled={isDisabled}
|
<Button disabled={isDisabled} color="primary" type="submit">
|
||||||
color="primary"
|
{t("update")}
|
||||||
type="submit"
|
</Button>
|
||||||
tooltip={!isAdminOrOwner ? t("owner_permission_needed") : undefined}>
|
</SectionBottomActions>
|
||||||
{t("update")}
|
)}
|
||||||
</Button>
|
|
||||||
</SectionBottomActions>
|
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user