Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IDE
.idea/

# Gradle
.gradle/
build/

# Compiled
bin/
3 changes: 2 additions & 1 deletion rafts/frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@
"password": "Password",
"email": "User Email",
"signing_in": "Signing in",
"forgot_password": "Forgot password?"
"forgot_password": "Forgot password?",
"create_account": "Create an account"
},
"profile": {
"name": "Name",
Expand Down
3 changes: 2 additions & 1 deletion rafts/frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@
"password": "Mot de passe",
"email": "Courriel de l'utilisateur",
"signing_in": "Connexion en cours...",
"forgot_password": "Mot de passe oublié?"
"forgot_password": "Mot de passe oublié?",
"create_account": "Créer un compte"
},
"profile": {
"name": "Nom",
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/assignReviewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const claimForReview = async (

return {
[SUCCESS]: true,
data: `RAFT claimed for review by "${reviewerName}"`,
data: `RAFTS claimed for review by "${reviewerName}"`,
}
}

Expand Down
6 changes: 3 additions & 3 deletions rafts/frontend/src/actions/createDOIForDraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ function buildMinimalDataCiteMetadata(title: string, creatorName: string): Recor
],
},
titles: {
$: [{ title: { $: title || 'Untitled RAFT Draft' } }],
$: [{ title: { $: title || 'Untitled RAFTS Draft' } }],
},
publisher: { $: 'NRC CADC' },
publicationYear: { $: publicationYear },
resourceType: {
'@resourceTypeGeneral': 'Dataset',
$: 'RAFT Announcement',
$: 'RAFTS Announcement',
},
},
}
Expand All @@ -144,7 +144,7 @@ function buildMinimalDataCiteMetadata(title: string, creatorName: string): Recor
* @returns DOI identifier and URL on success
*/
export async function createDOIForDraft(
title: string = 'Untitled RAFT Draft',
title: string = 'Untitled RAFTS Draft',
): Promise<IResponseData<CreateDOIResult>> {
const session = await auth()
const accessToken = session?.accessToken
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/deleteRaft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const deleteRaft = async (doiSuffix: string): Promise<IResponseData<strin
}
}

return { [SUCCESS]: true, [MESSAGE]: 'RAFT deleted successfully' }
return { [SUCCESS]: true, [MESSAGE]: 'RAFTS deleted successfully' }
} catch (error) {
console.error('[deleteRaft] Exception:', error)
return {
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/getInternalRaftById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const getInternalRaftById = async (id: string) => {
if (mockRaft) {
return { success: true, data: mockRaft }
} else {
return { success: false, error: 'RAFT not found' }
return { success: false, error: 'RAFTS not found' }
}
}

Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/getRaftById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const getRaftById = async (id: string) => {
if (mockRaft) {
return { success: true, data: mockRaft }
} else {
return { success: false, error: 'RAFT not found' }
return { success: false, error: 'RAFTS not found' }
}
}

Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/getRaftReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const getRaftReview = async (raftId: string) => {
const mockRaft = getMockRaftById(raftId)

if (!mockRaft) {
return { success: false, error: 'RAFT not found' }
return { success: false, error: 'RAFTS not found' }
}

// Create a mock review based on the RAFT status
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/publishRaftDoi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const publishRAFTDOI = async (

return {
[SUCCESS]: true,
[MESSAGE]: 'RAFT status changed to Published.',
[MESSAGE]: 'RAFTS status changed to Published.',
}
} catch (error) {
console.error('[publishRAFTDOI] Error:', error)
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/submitDOI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const submitDOI = async (formData: TRaftContext): Promise<IResponseData<s
console.error('[submitDOI] RAFT.json upload failed:', uploadResult.error.message)
return {
[SUCCESS]: false,
[MESSAGE]: `DOI created (${identifier}) but RAFT data save failed: ${uploadResult.error.message}`,
[MESSAGE]: `DOI created (${identifier}) but RAFTS data save failed: ${uploadResult.error.message}`,
}
}

Expand Down
4 changes: 2 additions & 2 deletions rafts/frontend/src/actions/submitForReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const submitForReview = async (

return {
[SUCCESS]: true,
data: 'RAFT submitted for review successfully',
data: 'RAFTS submitted for review successfully',
}
} catch (error) {
console.error('[submitForReview] Exception:', error)
Expand Down Expand Up @@ -268,7 +268,7 @@ export const revertToDraft = async (

return {
[SUCCESS]: true,
data: 'RAFT reverted to draft successfully',
data: 'RAFTS reverted to draft successfully',
}
} catch (error) {
console.error('[revertToDraft] Exception:', error)
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/updateDOIStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const updateDOIStatus = async (

return {
[SUCCESS]: true,
[MESSAGE]: `RAFT status changed to ${getStatusDisplayName(newStatus)}.`,
[MESSAGE]: `RAFTS status changed to ${getStatusDisplayName(newStatus)}.`,
data: responseText,
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion rafts/frontend/src/actions/updateRaft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const updateRaft = async (
}

if (!raftId) {
return { success: false, error: 'RAFT ID is required for updates' }
return { success: false, error: 'RAFTS ID is required for updates' }
}

// Prepare the payload for submission
Expand Down
4 changes: 2 additions & 2 deletions rafts/frontend/src/app/[locale]/form/edit/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ export async function generateMetadata(props: {

if (!success || !data) {
return {
title: 'RAFT Not Found',
title: 'RAFTS Not Found',
}
}

return {
title: `RAFT - ${data?.generalInfo?.title || 'View RAFT'}`,
title: `RAFTS - ${data?.generalInfo?.title || 'View RAFTS'}`,
description:
data.observationInfo?.abstract?.substring(0, 160) ||
'Research Announcement For The Solar System',
Expand Down
3 changes: 2 additions & 1 deletion rafts/frontend/src/app/[locale]/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import LoginForm from '@/components/User/LoginForm'
import LoginFormLayout from '@/components/Layout/LoginFormLayout'
import { auth } from '@/auth/cadc-auth/credentials'
import { authenticateUser } from '@/actions/auth'
import { isStaleSession } from '@/auth/cadc-auth/isStaleSession'

// Define types that match what Next.js is expecting
interface PageProps {
Expand All @@ -85,7 +86,7 @@ const LoginPage = async ({ searchParams }: PageProps) => {
const session = await auth()
const defaultReturnUrl = '/'

if (session) {
if (session && !isStaleSession(session)) {
redirect((resolvedSearchParams.returnUrl as string) || defaultReturnUrl)
}

Expand Down
3 changes: 2 additions & 1 deletion rafts/frontend/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@

import LandingChoice from '@/components/LandingPage/LandingChoice'
import { auth } from '@/auth/cadc-auth/credentials'
import { isStaleSession } from '@/auth/cadc-auth/isStaleSession'

const HomePage = async () => {
const session = await auth()

return <LandingChoice session={session} />
return <LandingChoice session={isStaleSession(session) ? null : session} />
}

export default HomePage
10 changes: 5 additions & 5 deletions rafts/frontend/src/app/[locale]/public-view/doi/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function View() {
setDoiData(data)
} else {
console.error('Error fetching DOI data:', error)
setError('Failed to load RAFT data. Please try again later.')
setError('Failed to load RAFTS data. Please try again later.')
}
setIsLoading(false)
}
Expand All @@ -101,7 +101,7 @@ export default function View() {
// Data fetched successfully
} else {
console.error('Error fetching DOI data:', error)
setError('Failed to load RAFT data. Please try again later.')
setError('Failed to load RAFTS data. Please try again later.')
}
setIsLoading(false)
}
Expand All @@ -112,12 +112,12 @@ export default function View() {
return (
<div className="grid grid-rows-[auto_1fr_auto] items-center min-h-screen p-4 pb-8 gap-8 sm:p-8 font-[family-name:var(--font-geist-sans)]">
<header className="row-start-1 w-full">
<h1 className="text-2xl font-bold mb-4">Your submissions (RAFTs)</h1>
<h1 className="text-2xl font-bold mb-4">Your submissions (RAFTSs)</h1>
</header>
<main className="row-start-2 w-full max-w-7xl mx-auto">
{isLoading ? (
<div className="flex justify-center items-center h-64">
<span>Loading RAFT data...</span>
<span>Loading RAFTS data...</span>
</div>
) : error ? (
<div className="text-red-500 p-4 border border-red-300 rounded bg-red-50">{error}</div>
Expand All @@ -126,7 +126,7 @@ export default function View() {
)}
</main>
<footer className="row-start-3 w-full text-center text-sm text-gray-500 mt-8">
<div>CADC RAFT Publication System</div>
<div>CADC RAFTS Publication System</div>
</footer>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export async function generateMetadata(props: {

if (!success || !data) {
return {
title: 'RAFT Not Found',
title: 'RAFTS Not Found',
}
}

return {
title: `RAFT - ${data?.generalInfo?.title || 'View RAFT'}`,
title: `RAFTS - ${data?.generalInfo?.title || 'View RAFTS'}`,
description:
data.observationInfo?.abstract?.substring(0, 160) ||
'Research Announcement For The Solar System',
Expand Down
8 changes: 4 additions & 4 deletions rafts/frontend/src/app/[locale]/public-view/rafts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function View() {
setRaftData(data.data)
} else {
console.error('Error fetching DOI data:', error)
setError('Failed to load RAFT data. Please try again later.')
setError('Failed to load RAFTS data. Please try again later.')
}
setIsLoading(false)
}
Expand All @@ -96,12 +96,12 @@ export default function View() {
return (
<div className="grid grid-rows-[auto_1fr_auto] items-center min-h-screen p-4 pb-8 gap-8 sm:p-8 font-[family-name:var(--font-geist-sans)]">
<header className="row-start-1 w-full">
<h1 className="text-2xl font-bold mb-4">All Published (RAFTs)</h1>
<h1 className="text-2xl font-bold mb-4">All Published (RAFTSs)</h1>
</header>
<main className="row-start-2 w-full max-w-7xl mx-auto">
{isLoading ? (
<div className="flex justify-center items-center h-64">
<span>Loading RAFTs...</span>
<span>Loading RAFTSs...</span>
</div>
) : error ? (
<div className="text-red-500 p-4 border border-red-300 rounded bg-red-50">{error}</div>
Expand All @@ -110,7 +110,7 @@ export default function View() {
)}
</main>
<footer className="row-start-3 w-full text-center text-sm text-gray-500 mt-8">
<div>CADC RAFT Publication System</div>
<div>CADC RAFTS Publication System</div>
</footer>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions rafts/frontend/src/app/[locale]/review/rafts/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export async function generateMetadata(props: {
}

return {
title: `Review RAFT - ${data?.generalInfo?.title || 'Review RAFT'}`,
title: `Review RAFTS - ${data?.generalInfo?.title || 'Review RAFTS'}`,
description:
data.observationInfo?.abstract?.substring(0, 160) ||
'Research Announcement For The Solar System',
'Research Announcements For The Solar System',
}
}

Expand Down
6 changes: 3 additions & 3 deletions rafts/frontend/src/app/[locale]/review/rafts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export default function ReviewRafts() {
<div className="grid grid-rows-[auto_1fr_auto] items-center min-h-screen p-4 pb-8 gap-8 sm:p-8">
<header className="row-start-1 w-full">
<Typography variant="h4" component="h1" gutterBottom fontWeight="bold">
Review RAFT Submissions
Review RAFTS Submissions
</Typography>
<Typography variant="body1" color="text.secondary" gutterBottom>
Manage and review RAFT submissions based on their current status.
Manage and review RAFTS submissions based on their current status.
</Typography>

<StatusFilter
Expand Down Expand Up @@ -155,7 +155,7 @@ export default function ReviewRafts() {
</main>

<footer className="row-start-3 w-full text-center text-sm text-gray-500 mt-8">
<div>CADC RAFT Publication System</div>
<div>CADC RAFTS Publication System</div>
</footer>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions rafts/frontend/src/app/[locale]/view/rafts/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ export async function generateMetadata(props: {

if (!success || !data) {
return {
title: 'RAFT Not Found',
title: 'RAFTS Not Found',
}
}

return {
title: `RAFT - ${data?.generalInfo?.title || 'View RAFT'}`,
title: `RAFTS - ${data?.generalInfo?.title || 'View RAFTS'}`,
description:
data.observationInfo?.abstract?.substring(0, 160) ||
'Research Announcement For The Solar System',
Expand Down
6 changes: 3 additions & 3 deletions rafts/frontend/src/app/[locale]/view/rafts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function View() {
await signOut()
}
console.error('Error fetching DOI data:', error)
setError('Failed to load RAFT data. Please try again later.')
setError('Failed to load RAFTS data. Please try again later.')
}
setIsLoading(false)
}, [])
Expand All @@ -109,7 +109,7 @@ export default function View() {
<div className="grid grid-rows-[auto_1fr_auto] items-center min-h-screen p-4 pb-8 gap-8 sm:p-8 font-[family-name:var(--font-geist-sans)]">
<header className="row-start-1 w-full">
<div className="flex justify-between items-center mb-4">
<h1 className="text-2xl font-bold">Your submissions (RAFTs)</h1>
<h1 className="text-2xl font-bold">Your submissions (RAFTSs)</h1>
<Link href="/form/create">
<Button variant="contained" color="primary" startIcon={<Add />} size="medium">
Create New Raft
Expand All @@ -125,7 +125,7 @@ export default function View() {
)}
</main>
<footer className="row-start-3 w-full text-center text-sm text-gray-500 mt-8">
<div>CADC RAFT Publication System</div>
<div>CADC RAFTS Publication System</div>
</footer>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import { NextRequest, NextResponse } from 'next/server'
import { auth } from '@/auth/cadc-auth/credentials'
import { downloadAttachment } from '@/services/attachmentService'
import { sanitizeFilename } from '@/types/attachments'

export async function GET(
request: NextRequest,
Expand Down Expand Up @@ -121,7 +122,7 @@ export async function GET(
return new NextResponse(arrayBuffer, {
headers: {
'Content-Type': result.mimeType || 'application/octet-stream',
'Content-Disposition': `inline; filename="${decodedFilename}"`,
'Content-Disposition': `inline; filename="${sanitizeFilename(decodedFilename)}"`,
'Cache-Control': 'private, max-age=3600', // Cache for 1 hour
},
})
Expand Down
Loading