From e1be2df4bcd360a62717602a189c293c51484f0e Mon Sep 17 00:00:00 2001 From: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:36:57 +0530 Subject: [PATCH] enabled app sharing before release of app (#10483) * enabled app sharing before release of app * removed tooltip and added css on copy icon * made share button behaviour consistent to preview * added conditional rendering for check box in the modal * added empty state component * removed unnecessary code * fixed alignment in both versions * added css for empty state component * fixed version released modal * added tooltip css fixes pending * fixed alignment using custom css * removed share button disable dependencies * fixed cursor pointer issue in share button * changed copywriting message * removed unnecessary methods --- .../RightTopHeaderButtons/ManageAppUsers.jsx | 263 +++++++++++------- frontend/src/_helpers/constants.js | 1 + .../_ui/HttpHeaders/sourceEditorStyles.scss | 148 +++++----- 3 files changed, 242 insertions(+), 170 deletions(-) diff --git a/frontend/src/Editor/Header/RightTopHeaderButtons/ManageAppUsers.jsx b/frontend/src/Editor/Header/RightTopHeaderButtons/ManageAppUsers.jsx index 45f05b4af1..a8d34774cb 100644 --- a/frontend/src/Editor/Header/RightTopHeaderButtons/ManageAppUsers.jsx +++ b/frontend/src/Editor/Header/RightTopHeaderButtons/ManageAppUsers.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { appService, appsService, authenticationService } from '@/_services'; import Modal from 'react-bootstrap/Modal'; import { toast } from 'react-hot-toast'; @@ -15,6 +15,7 @@ import { ToolTip } from '@/_components/ToolTip'; import { TOOLTIP_MESSAGES } from '@/_helpers/constants'; import { useAppDataStore } from '@/_stores/appDataStore'; import { retrieveWhiteLabelText } from '@white-label/whiteLabelling'; +import InfoIcon from '@assets/images/icons/info.svg'; class ManageAppUsersComponent extends React.Component { constructor(props) { @@ -32,6 +33,7 @@ class ManageAppUsersComponent extends React.Component { value: null, error: '', }, + isHovered: false, isSlugUpdated: false, }; } @@ -85,7 +87,6 @@ class ManageAppUsersComponent extends React.Component { toast.error(error); }); }; - toggleAppVisibility = () => { const newState = !this.props.isPublic; this.setState({ @@ -170,7 +171,13 @@ class ManageAppUsersComponent extends React.Component { }); } }; + handleMouseEnter = () => { + this.setState({ isHovered: true }); + }; + handleMouseLeave = () => { + this.setState({ isHovered: false }); + }; render() { const { appId, isSlugVerificationInProgress, newSlug, isSlugUpdated } = this.state; @@ -178,66 +185,104 @@ class ManageAppUsersComponent extends React.Component { const shareableLink = appLink + (this.props.slug || appId); const slugButtonClass = !_.isEmpty(newSlug.error) ? 'is-invalid' : 'is-valid'; const embeddableLink = ``; - const shouldWeDisableShareModal = !this.props.isVersionReleased; + const { isHovered } = this.state.isHovered; return ( - -
+ { + this.validateThePreExistingSlugs(); + this.setState({ showModal: true }); + }} > { - this.validateThePreExistingSlugs(); - !shouldWeDisableShareModal && this.setState({ showModal: true }); - }} > - - - {this.props.t('editor.share', 'Share')} - - - - - - { - ); } } diff --git a/frontend/src/_helpers/constants.js b/frontend/src/_helpers/constants.js index 614a64ffb3..59d06df60a 100644 --- a/frontend/src/_helpers/constants.js +++ b/frontend/src/_helpers/constants.js @@ -91,6 +91,7 @@ export const ERROR_MESSAGES = { export const TOOLTIP_MESSAGES = { SHARE_URL_UNAVAILABLE: 'Share URL is unavailable until current version is released', + RELEASE_VERSION_URL_UNAVAILABLE: 'Release the version to make it public', }; export const DATA_SOURCE_TYPE = { diff --git a/frontend/src/_ui/HttpHeaders/sourceEditorStyles.scss b/frontend/src/_ui/HttpHeaders/sourceEditorStyles.scss index b6de1cea5a..a625c2dcfd 100644 --- a/frontend/src/_ui/HttpHeaders/sourceEditorStyles.scss +++ b/frontend/src/_ui/HttpHeaders/sourceEditorStyles.scss @@ -1,78 +1,94 @@ input.form-control, - textarea, - .input-control { - gap: 16px !important; - background: var(--base) !important; - border: 1px solid var(--slate7) !important; - border-radius: 6px; - margin-bottom: 4px !important; - color: var(--slate12) !important; - transition: none; - height: 35px; - padding-left: 0.4375rem; - padding-right: 0.4375rem; - padding-top: 0.75rem; - padding-bottom: 0.75rem; - overflow-x: 'auto'; - white-space: 'nowrap'; +textarea, +.input-control { + gap: 16px !important; + background: var(--base) !important; + border: 1px solid var(--slate7) !important; + border-radius: 6px; + margin-bottom: 4px !important; + color: var(--slate12) !important; + transition: none; + height: 35px; + padding-left: 0.4375rem; + padding-right: 0.4375rem; + padding-top: 0.75rem; + padding-bottom: 0.75rem; + overflow-x: 'auto'; + white-space: 'nowrap'; + &:hover { + background: var(--slate1) !important; + border: 1px solid var(--slate8) !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; + outline: none; + } + + &:focus-visible { + background: var(--indigo2) !important; + border: 1px solid var(--indigo9) !important; + box-shadow: none !important; + } + + &.input-error-border { + border-color: #DB4324 !important; + } + + &:-webkit-autofill { + box-shadow: 0 0 0 1000px var(--base) inset !important; + -webkit-text-fill-color: var(--slate12) !important; + &:hover { - background: var(--slate1) !important; - border: 1px solid var(--slate8) !important; - -webkit-box-shadow: none !important; - box-shadow: none !important; - outline: none; + box-shadow: 0 0 0 1000px var(--slate1) inset !important; + -webkit-text-fill-color: var(--slate12) !important; } &:focus-visible { - background: var(--indigo2) !important; - border: 1px solid var(--indigo9) !important; - box-shadow: none !important; - } - - &.input-error-border { - border-color: #DB4324 !important; - } - - &:-webkit-autofill { - box-shadow: 0 0 0 1000px var(--base) inset !important; + box-shadow: 0 0 0 1000px var(--indigo2) inset !important; -webkit-text-fill-color: var(--slate12) !important; - - &:hover { - box-shadow: 0 0 0 1000px var(--slate1) inset !important; - -webkit-text-fill-color: var(--slate12) !important; - } - - &:focus-visible { - box-shadow: 0 0 0 1000px var(--indigo2) inset !important; - -webkit-text-fill-color: var(--slate12) !important; - } } - } - .empty-key-value { - border-radius: 6px; - padding: 10px; - text-align: center; - width: 625px; - height: 32px; - display: flex; - align-items: center; - justify-content: center; - margin-bottom: 10px; - color: #687076; - font-size: 12px; - font-weight: 400; - line-height: 20px; - border: 1px dashed #E6E8EB; - } +} - .trash { - height: 32px; - display: flex; - justify-content: 'center'; - align-items: 'center'; - } - +.empty-key-value { + border-radius: 6px; + padding: 10px; + text-align: center; + width: 625px; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 10px; + color: #687076; + font-size: 12px; + font-weight: 400; + line-height: 20px; + border: 1px dashed #E6E8EB; +} + +.trash { + height: 32px; + display: flex; + justify-content: 'center'; + align-items: 'center'; +} + +.empty-version { + border-radius: 6px; + padding: 10px; + text-align: center; + width: auto; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 10px; + color: #687076; + font-size: 12px; + font-weight: 400; + line-height: 20px; + border: 1px dashed #E6E8EB; +} \ No newline at end of file