Skip to content

Commit

Permalink
Refs #36576 - Add description placeholder component, fix nitpicks
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Allison committed Aug 3, 2023
1 parent 1684614 commit 84a3110
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 12 additions & 7 deletions webpack/scenes/ActivationKeys/Details/ActivationKeyDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ import EditModal from './components/EditModal';
import DeleteMenu from './components/DeleteMenu';
import { getActivationKey } from './ActivationKeyActions';
import DeleteModal from './components/DeleteModal';
import InactiveText from '../../ContentViews/components/InactiveText';

const ActivationKeyDetails = ({ match }) => {
const dispatch = useDispatch();
const akId = match?.params?.id;
const akDetailsResponse = useSelector(state => selectAPIResponse(state, `ACTIVATION_KEY_${akId}`));
const akDetails = propsToCamelCase(akDetailsResponse);
const [isModalOpen, setModalOpen] = useState(false);

useEffect(() => {
if (akId) { // TODO add back akNotLoaded condition
if (akId) {
dispatch(getActivationKey(akId));
}
}, [akId, dispatch]);

const [isModalOpen, setModalOpen] = useState(false);
const handleModalToggle = () => {
setModalOpen(!isModalOpen);
};
Expand Down Expand Up @@ -94,11 +96,14 @@ const ActivationKeyDetails = ({ match }) => {
</GridItem>
</Grid>
<div className="ak-details-description">
<TextContent>
<Text ouiaId="ak-description" component={TextVariants.p}>
{akDetails.description ? akDetails.description : <span style={{ color: '#c1c1c1' }}>{__('No description provided')}</span>}
</Text>
</TextContent>
{akDetails.description ?
<TextContent>
<Text ouiaId="ak-description" component={TextVariants.p}>
{akDetails.description}
</Text>
</TextContent> :
<InactiveText text={__('No description provided')} />
}
</div>
</Panel>
<DeleteModal isModalOpen={isModalOpen} handleModalToggle={handleModalToggle} akId={akId} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const EditModal = ({ akDetails, akId }) => {
const [descriptionValue, setDescriptionValue] = useState(description);
const [maxHostsValue, setMaxHostsValue] = useState(initialMaxHosts);
const [isUnlimited, setUnlimited] = useState(unlimitedHosts);
const [isModalOpen, setModalOpen] = useState(false);

useEffect(() => {
setNameValue(name);
Expand All @@ -43,9 +44,6 @@ const EditModal = ({ akDetails, akId }) => {
setUnlimited(unlimitedHosts);
}, [name, description, initialMaxHosts, unlimitedHosts]);


const [isModalOpen, setModalOpen] = useState(false);

const refreshActivationKeyDetails = () => dispatch(getActivationKey(akId));

const handleModalToggle = () => {
Expand Down

0 comments on commit 84a3110

Please sign in to comment.