mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Sometimes, a bracket makes a huge difference
This commit is contained in:
parent
49301ae965
commit
45c872df28
1 changed files with 52 additions and 51 deletions
|
@ -653,62 +653,63 @@ function StatusPage() {
|
||||||
enableTranslate
|
enableTranslate
|
||||||
/>
|
/>
|
||||||
</InView>
|
</InView>
|
||||||
{uiState !== 'loading' && !authenticated ? (
|
{uiState !== 'loading' &&
|
||||||
<div class="post-status-banner">
|
(!authenticated ? (
|
||||||
<p>
|
|
||||||
You're not logged in. Interactions (reply, boost,
|
|
||||||
etc) are not possible.
|
|
||||||
</p>
|
|
||||||
<Link to="/login" class="button">
|
|
||||||
Log in
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
!sameInstance && (
|
|
||||||
<div class="post-status-banner">
|
<div class="post-status-banner">
|
||||||
<p>
|
<p>
|
||||||
This post is from another instance (
|
You're not logged in. Interactions (reply, boost,
|
||||||
<b>{instance}</b>). Interactions (reply, boost,
|
|
||||||
etc) are not possible.
|
etc) are not possible.
|
||||||
</p>
|
</p>
|
||||||
<button
|
<Link to="/login" class="button">
|
||||||
type="button"
|
Log in
|
||||||
disabled={uiState === 'loading'}
|
</Link>
|
||||||
onClick={() => {
|
|
||||||
setUIState('loading');
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
const results =
|
|
||||||
await currentMasto.v2.search({
|
|
||||||
q: heroStatus.url,
|
|
||||||
type: 'statuses',
|
|
||||||
resolve: true,
|
|
||||||
limit: 1,
|
|
||||||
});
|
|
||||||
if (results.statuses.length) {
|
|
||||||
const status = results.statuses[0];
|
|
||||||
navigate(
|
|
||||||
currentInstance
|
|
||||||
? `/${currentInstance}/s/${status.id}`
|
|
||||||
: `/s/${status.id}`,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
throw new Error('No results');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
setUIState('default');
|
|
||||||
alert('Error: ' + e);
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon icon="transfer" /> Switch to my instance to
|
|
||||||
enable interactions
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
) : (
|
||||||
)}
|
!sameInstance && (
|
||||||
|
<div class="post-status-banner">
|
||||||
|
<p>
|
||||||
|
This post is from another instance (
|
||||||
|
<b>{instance}</b>). Interactions (reply, boost,
|
||||||
|
etc) are not possible.
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={uiState === 'loading'}
|
||||||
|
onClick={() => {
|
||||||
|
setUIState('loading');
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const results =
|
||||||
|
await currentMasto.v2.search({
|
||||||
|
q: heroStatus.url,
|
||||||
|
type: 'statuses',
|
||||||
|
resolve: true,
|
||||||
|
limit: 1,
|
||||||
|
});
|
||||||
|
if (results.statuses.length) {
|
||||||
|
const status = results.statuses[0];
|
||||||
|
navigate(
|
||||||
|
currentInstance
|
||||||
|
? `/${currentInstance}/s/${status.id}`
|
||||||
|
: `/s/${status.id}`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw new Error('No results');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setUIState('default');
|
||||||
|
alert('Error: ' + e);
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="transfer" /> Switch to my instance
|
||||||
|
to enable interactions
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Link
|
<Link
|
||||||
|
|
Loading…
Reference in a new issue