-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from AntaresSimulatorTeam/feature/page_area_link
Feature/page area link
- Loading branch information
Showing
21 changed files
with
510 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import {useState} from 'react'; | ||
import {ColumnDef} from '@tanstack/react-table'; | ||
import StdSimpleTable from '@common/data/stdSimpleTable/StdSimpleTable'; | ||
import {RdsButton, RdsInputText} from "rte-design-system-react"; | ||
|
||
|
||
type RowStatus = 'Missing' | 'OK' | 'Error'; | ||
|
||
type RowData = { | ||
hypothesis: string; | ||
trajectory: string | null; // Null si aucune trajectoire n'est sélectionnée | ||
status: RowStatus; | ||
}; | ||
|
||
const AreaLinkTab = () => { | ||
const [data, setData] = useState<RowData[]>([ | ||
{hypothesis: 'Areas', trajectory: null, status: 'Missing'}, | ||
{hypothesis: 'Links', trajectory: null, status: 'Missing'}, | ||
]); | ||
|
||
const handleImport = (index: number) => { | ||
const updatedData = [...data]; | ||
updatedData[index].trajectory = 'BP_23_ref'; | ||
updatedData[index].status = 'OK'; | ||
setData(updatedData); | ||
}; | ||
|
||
const columns: ColumnDef<RowData>[] = [ | ||
{ | ||
header: 'Hypothesis', | ||
accessorKey: 'hypothesis', | ||
}, | ||
{ | ||
header: 'Trajectory to use', | ||
cell: ({row}) => { | ||
const index = row.index; | ||
const {trajectory} = row.original; | ||
return trajectory ? ( | ||
<div className="flex items-center space-x-2"> | ||
<span>{trajectory}</span> | ||
</div> | ||
) : ( | ||
<div className="flex items-center space-x-2"> | ||
<RdsInputText label="" | ||
value="" | ||
placeHolder="choose a Trajectory" | ||
variant="outlined"/> | ||
<span>or</span> | ||
<RdsButton label="Import" onClick={() => handleImport(index)}/> | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
header: 'Status', | ||
cell: ({row}) => { | ||
const {status} = row.original; | ||
if (status === 'Missing') return <span>❓ Missing</span>; | ||
if (status === 'OK') return <span>✔ OK</span>; | ||
if (status === 'Error') return <span>❌ Error</span>; | ||
return null; | ||
}, | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="flex-1"> | ||
<StdSimpleTable id="example-table" data={data} columns={columns} columnSize="meta"/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AreaLinkTab; |
31 changes: 31 additions & 0 deletions
31
src/pages/pegase/studies/studyDetails/AreaLinkTableHeaders.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { createColumnHelper } from '@tanstack/react-table'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { RdsButton } from 'rte-design-system-react'; | ||
|
||
const columnHelper = createColumnHelper<any>(); | ||
|
||
const getAreaLinkTableHeaders = () => { | ||
const { t } = useTranslation(); | ||
return [ | ||
columnHelper.accessor('hypothesis', { | ||
header: t('home.@hypothesis'), | ||
}), | ||
|
||
columnHelper.accessor('trajectroy', { | ||
header: t('home.@trajectory'), | ||
cell: () => <RdsButton label="import" />, | ||
}), | ||
|
||
columnHelper.accessor('status', { | ||
header: t('home.@status'), | ||
}), | ||
]; | ||
}; | ||
|
||
export default getAreaLinkTableHeaders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
const EnrTab = () => { | ||
|
||
|
||
return ( | ||
<div className="flex-1"> | ||
<h1>Energy</h1> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EnrTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
const LoadTab = () => { | ||
|
||
|
||
return ( | ||
<div className="flex-1"> | ||
<h1>Load</h1> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoadTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
const MiscTab = () => { | ||
|
||
|
||
return ( | ||
<div className="flex-1"> | ||
<h1>Misc</h1> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MiscTab; |
48 changes: 48 additions & 0 deletions
48
src/pages/pegase/studies/studyDetails/StudyDetailsContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { formatDateToDDMMYYYY } from '@/shared/utils/dateFormatter'; | ||
import { StudyDTO } from '@/shared/types'; | ||
import { RdsIcon, RdsIconId, RdsTagList } from 'rte-design-system-react'; | ||
import StdIcon from '@common/base/stdIcon/StdIcon'; | ||
import { StdIconId } from '@/shared/utils/common/mappings/iconMaps'; | ||
|
||
type ProjectDetailsContentProps = { | ||
study: StudyDTO; | ||
}; | ||
|
||
export const StudyDetailsContent = ({ study }: ProjectDetailsContentProps) => { | ||
return ( | ||
<div className="flex flex-col gap-3 p-3"> | ||
<div className="group flex flex-col gap-3 rounded bg-primary-100 p-2" role="banner"> | ||
<div className="flex items-center justify-between font-sans font-light text-gray-500"> | ||
<div className="flex items-center gap-3"> | ||
<div className="flex flex-[1_0_0] items-center gap-6"> | ||
<div>Study : {study.name}</div> | ||
<div className="flex items-center gap-2"> | ||
<RdsIcon name={RdsIconId.History} color="secondary" /> | ||
{formatDateToDDMMYYYY(study.creationDate)} | ||
</div> | ||
<div className="flex items-center gap-2"> | ||
<RdsIcon name={RdsIconId.Person} color="secondary" /> | ||
By : {study.createdBy} | ||
</div> | ||
<div className="flex items-center gap-2"> | ||
<StdIcon name={StdIconId.TimeLine} color="secondary" /> | ||
Horizon : {study.horizon} | ||
</div> | ||
<div className="flex h-3 w-32"> | ||
<RdsTagList id={`${study.id}-tag-list`} tags={study.keywords} /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default StudyDetailsContent; |
Oops, something went wrong.