Skip to content

Commit ce969d6

Browse files
committed
Merge branch 'staging'
2 parents 4cb3182 + 333752a commit ce969d6

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

app/(userSection)/account/account-info.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@ import Login from './login'
1212

1313
const SignOutListener = () => {
1414
const searchParams = useSearchParams()
15+
const { status } = useSession()
1516

1617
useEffect(() => {
17-
if (searchParams.get('signOut')) {
18+
if (!searchParams.get('signOut')) return
19+
20+
if (status === 'authenticated') {
1821
signOut()
19-
const params = new URLSearchParams(searchParams.toString())
20-
params.delete('signOut')
21-
const filteredParams = params.toString()
22-
window.history.replaceState(
23-
null,
24-
'',
25-
`${window.location.pathname}${filteredParams ? `?${filteredParams}` : ''}`,
26-
)
22+
return
2723
}
28-
}, [searchParams])
24+
25+
const params = new URLSearchParams(searchParams.toString())
26+
params.delete('signOut')
27+
const filteredParams = params.toString()
28+
window.history.replaceState(
29+
null,
30+
'',
31+
`${window.location.pathname}${filteredParams ? `?${filteredParams}` : ''}`,
32+
)
33+
}, [searchParams, status])
2934

3035
return null
3136
}
@@ -34,12 +39,12 @@ const AccountInfo = () => {
3439
const { data: session, status, update } = useSession()
3540
return (
3641
<SharedLayout title='Account'>
42+
<Suspense>
43+
<SignOutListener />
44+
</Suspense>
45+
3746
{status === 'authenticated' && session?.user ? (
3847
<>
39-
<Suspense>
40-
<SignOutListener />
41-
</Suspense>
42-
4348
<Row columns={[6, 6, 8, 8]}>
4449
<Column start={1} width={[6, 4, 5, 4]}>
4550
<Field description='CDRXIV uses Janeway for authentication. Signing out does not deactivate your Janeway session.'>

app/preprint/[id]/preprint-metadata.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ const PreprintMetadata: React.FC<{
5858
const dataLicense = getAdditionalField(preprint, 'Data license')
5959
const dataLicenseInfo = getZenodoLicense(preprint)
6060
const articleLicenseInfo = getArticleLicense(preprint.license?.pk)
61-
const hasConflictOfInterest =
62-
conflictOfInterest && conflictOfInterest !== 'None'
6361

6462
return (
6563
<Flex sx={{ flexDirection: 'column', gap: [6, 8, 9, 9] }}>
@@ -275,11 +273,19 @@ const PreprintMetadata: React.FC<{
275273
</Field>
276274
)}
277275

278-
{hasConflictOfInterest && (
279-
<Field label='Conflict of interest'>
280-
<Box sx={{ variant: 'text.mono' }}>{conflictOfInterest}</Box>
281-
</Field>
282-
)}
276+
<Field label='Conflict of interest'>
277+
<Box
278+
sx={{
279+
variant: 'text.mono',
280+
color:
281+
conflictOfInterest && conflictOfInterest !== 'None'
282+
? 'text'
283+
: 'listBorderGrey',
284+
}}
285+
>
286+
{conflictOfInterest ?? 'None'}
287+
</Box>
288+
</Field>
283289

284290
{preprint.date_published && (
285291
<Field label={preprint.versions.length === 1 ? 'Published' : 'Dates'}>

0 commit comments

Comments
 (0)