|
|
@@ -26,3 +26,24 @@ export const NotAvailableForReadOnlyUser: React.FC<{
|
|
|
);
|
|
|
});
|
|
|
NotAvailableForReadOnlyUser.displayName = 'NotAvailableForReadOnlyUser';
|
|
|
+
|
|
|
+
|
|
|
+export const NotAvailableWhenReadOnlyUserNotAllowedToComment: React.FC<{
|
|
|
+ children: JSX.Element
|
|
|
+}> = React.memo(({ children }) => {
|
|
|
+ const { t } = useTranslation();
|
|
|
+ const { data: isReadOnlyUser } = useIsReadOnlyUser();
|
|
|
+
|
|
|
+ const isDisabled = !!isReadOnlyUser;
|
|
|
+ const title = t('Not available for read only user');
|
|
|
+
|
|
|
+ return (
|
|
|
+ <NotAvailable
|
|
|
+ isDisabled={isDisabled}
|
|
|
+ title={title}
|
|
|
+ classNamePrefix="grw-not-available-for-read-only-user"
|
|
|
+ >
|
|
|
+ {children}
|
|
|
+ </NotAvailable>
|
|
|
+ );
|
|
|
+});
|