pass in contentName to repost modal
This commit is contained in:
parent
d7506850b3
commit
233a2b27ba
2 changed files with 6 additions and 4 deletions
|
@ -6,20 +6,22 @@ import RepostCreate from 'component/repostCreate';
|
||||||
import useThrottle from 'effects/use-throttle';
|
import useThrottle from 'effects/use-throttle';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri?: string,
|
||||||
|
contentName?: string,
|
||||||
|
// --- redux ---
|
||||||
closeModal: () => void,
|
closeModal: () => void,
|
||||||
resolveUri: (string) => void,
|
resolveUri: (string) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ModalRepost(props: Props) {
|
function ModalRepost(props: Props) {
|
||||||
const { uri, closeModal, resolveUri } = props;
|
const { uri, contentName, closeModal, resolveUri } = props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
location: { search },
|
location: { search },
|
||||||
} = useHistory();
|
} = useHistory();
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
const param = urlParams.get('name') || urlParams.get('q');
|
const param = urlParams.get('name') || urlParams.get('q') || contentName;
|
||||||
const repostTo = param && param[0] === '@' ? param.slice(1) : param;
|
const repostTo = param && param[0] === '@' ? param.slice(1) : param;
|
||||||
|
|
||||||
const [contentUri, setContentUri] = React.useState('');
|
const [contentUri, setContentUri] = React.useState('');
|
||||||
|
|
|
@ -192,7 +192,7 @@ export default function ShowPage(props: Props) {
|
||||||
<Button
|
<Button
|
||||||
button="secondary"
|
button="secondary"
|
||||||
label={__('Repost Something')}
|
label={__('Repost Something')}
|
||||||
onClick={() => doOpenModal(MODALS.REPOST, {})}
|
onClick={() => doOpenModal(MODALS.REPOST, { contentName })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue