Merge branch 'handle-null-group' into 'develop'
Handle null group in confirmation step See merge request soapbox-pub/soapbox!2472
This commit is contained in:
commit
b0ac174f80
2 changed files with 9 additions and 5 deletions
|
@ -94,7 +94,7 @@ const CreateGroupModal: React.FC<ICreateGroupModal> = ({ onClose }) => {
|
||||||
case Steps.TWO:
|
case Steps.TWO:
|
||||||
return <DetailsStep params={params} onChange={setParams} />;
|
return <DetailsStep params={params} onChange={setParams} />;
|
||||||
case Steps.THREE:
|
case Steps.THREE:
|
||||||
return <ConfirmationStep group={group!} />;
|
return <ConfirmationStep group={group} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import copy from 'soapbox/utils/copy';
|
||||||
import type { Group } from 'soapbox/schemas';
|
import type { Group } from 'soapbox/schemas';
|
||||||
|
|
||||||
interface IConfirmationStep {
|
interface IConfirmationStep {
|
||||||
group: Group
|
group: Group | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -19,20 +19,24 @@ const ConfirmationStep: React.FC<IConfirmationStep> = ({ group }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const handleCopyLink = () => {
|
const handleCopyLink = () => {
|
||||||
copy(`${window.location.origin}/group/${group.slug}`, () => {
|
copy(`${window.location.origin}/group/${group?.slug}`, () => {
|
||||||
toast.success(intl.formatMessage(messages.copied));
|
toast.success(intl.formatMessage(messages.copied));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleShare = () => {
|
const handleShare = () => {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
text: group.display_name,
|
text: group?.display_name,
|
||||||
url: group.uri,
|
url: group?.uri,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
if (e.name !== 'AbortError') console.error(e);
|
if (e.name !== 'AbortError') console.error(e);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!group) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack space={9}>
|
<Stack space={9}>
|
||||||
<Stack space={3}>
|
<Stack space={3}>
|
||||||
|
|
Loading…
Reference in a new issue