-
Notifications
You must be signed in to change notification settings - Fork 0
#24: refine crossmatch details page #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0374d85
#24: refine crossmatch details page
Kraysent f9019af
change coordinate formatting
Kraysent c4e7bcd
refactor catalog data component
Kraysent 4776520
merge link button and link
Kraysent 1531f66
add link to the original object in OHP
Kraysent 685b33f
merge errors with values
Kraysent e5f56e8
added markers to aladin widget
Kraysent 71db7b7
aladin styling
Kraysent 90c2967
compact tables
Kraysent d0cc6bb
add name to catalogs data
Kraysent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,139 +1,136 @@ | ||
| import { ReactElement } from "react"; | ||
Kraysent marked this conversation as resolved.
Show resolved
Hide resolved
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Кнопка Skip/Go Back/Go to table
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сделаю отдельно
Kraysent marked this conversation as resolved.
Show resolved
Hide resolved
Kraysent marked this conversation as resolved.
Show resolved
Hide resolved
Kraysent marked this conversation as resolved.
Show resolved
Hide resolved
Kraysent marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { CommonTable } from "./common-table"; | ||
| import { PgcObject, Schema } from "../../clients/backend/types.gen"; | ||
| import { Catalogs, Schema } from "../../clients/backend/types.gen"; | ||
|
|
||
| interface CatalogDataProps { | ||
| object: PgcObject; | ||
| schema: Schema | null; | ||
| catalogs: Catalogs; | ||
| schema: Schema; | ||
| } | ||
|
|
||
| function formatValueWithError( | ||
| value: number | undefined, | ||
| error: number | undefined, | ||
| unit?: string, | ||
| decimalPlaces: number = 0, | ||
| ): string { | ||
| if (value === undefined) return "NULL"; | ||
| const formattedValue = value.toFixed(decimalPlaces); | ||
| const formattedError = | ||
| error?.toFixed(decimalPlaces) || "0".padEnd(decimalPlaces + 1, "0"); | ||
|
|
||
| if (!unit) { | ||
| return `${formattedValue} ± ${formattedError}`; | ||
| } | ||
|
|
||
| return `${formattedValue} ${unit} ± ${formattedError} ${unit}`; | ||
| } | ||
|
|
||
| export function CatalogData({ | ||
| object, | ||
| catalogs, | ||
| schema, | ||
| }: CatalogDataProps): ReactElement { | ||
| if (!object || !schema) return <div />; | ||
|
|
||
| const coordinatesColumns = [ | ||
| { name: "Parameter" }, | ||
| { name: "Value" }, | ||
| { name: "Unit" }, | ||
| { name: "Error" }, | ||
| { name: "Error unit" }, | ||
| ]; | ||
|
|
||
| const coordinatesData = [ | ||
| { | ||
| Parameter: "Right ascension", | ||
| Value: object.catalogs?.coordinates?.equatorial?.ra?.toFixed(6) || "NULL", | ||
| Unit: schema.units.coordinates?.equatorial?.ra || "NULL", | ||
| Error: | ||
| object.catalogs?.coordinates?.equatorial?.e_ra?.toFixed(6) || "NULL", | ||
| "Error unit": schema.units.coordinates?.equatorial?.e_ra || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "Declination", | ||
| Value: | ||
| object.catalogs?.coordinates?.equatorial?.dec?.toFixed(6) || "NULL", | ||
| Unit: schema.units.coordinates?.equatorial?.dec || "NULL", | ||
| Error: | ||
| object.catalogs?.coordinates?.equatorial?.e_dec?.toFixed(6) || "NULL", | ||
| "Error unit": schema.units.coordinates?.equatorial?.e_dec || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "Galactic longitude", | ||
| Value: object.catalogs?.coordinates?.galactic?.lon?.toFixed(6) || "NULL", | ||
| Unit: schema.units.coordinates?.galactic?.lon || "NULL", | ||
| Error: | ||
| object.catalogs?.coordinates?.galactic?.e_lon?.toFixed(6) || "NULL", | ||
| "Error unit": schema.units.coordinates?.galactic?.e_lon || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "Galactic latitude", | ||
| Value: object.catalogs?.coordinates?.galactic?.lat?.toFixed(6) || "NULL", | ||
| Unit: schema.units.coordinates?.galactic?.lat || "NULL", | ||
| Error: | ||
| object.catalogs?.coordinates?.galactic?.e_lat?.toFixed(6) || "NULL", | ||
| "Error unit": schema.units.coordinates?.galactic?.e_lat || "NULL", | ||
| }, | ||
| ]; | ||
| if (!catalogs) return <div />; | ||
|
|
||
| const redshiftColumns = [ | ||
| { name: "Parameter" }, | ||
| { name: "Value" }, | ||
| { name: "Error" }, | ||
| ]; | ||
| const columns = [{ name: "Parameter" }, { name: "Value" }]; | ||
|
|
||
| const redshiftData = [ | ||
| { | ||
| Parameter: "z", | ||
| Value: object.catalogs?.redshift?.z?.toFixed(6) || "NULL", | ||
| Error: object.catalogs?.redshift?.e_z?.toFixed(6) || "NULL", | ||
| }, | ||
| ]; | ||
| const data = []; | ||
|
|
||
| const velocityColumns = [ | ||
| { name: "Parameter" }, | ||
| { name: "Value" }, | ||
| { name: "Unit" }, | ||
| { name: "Error" }, | ||
| { name: "Error unit" }, | ||
| ]; | ||
| if (catalogs?.designation?.name) { | ||
| data.push({ | ||
| Parameter: "Name", | ||
| Value: catalogs.designation.name, | ||
| }); | ||
| } | ||
|
|
||
| const velocityData = [ | ||
| { | ||
| Parameter: "Heliocentric", | ||
| Value: object.catalogs?.velocity?.heliocentric?.v?.toFixed(2) || "NULL", | ||
| Unit: schema.units.velocity?.heliocentric?.v || "NULL", | ||
| Error: object.catalogs?.velocity?.heliocentric?.e_v?.toFixed(2) || "NULL", | ||
| "Error unit": schema.units.velocity?.heliocentric?.e_v || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "Local Group", | ||
| Value: object.catalogs?.velocity?.local_group?.v?.toFixed(2) || "NULL", | ||
| Unit: schema.units.velocity?.local_group?.v || "NULL", | ||
| Error: object.catalogs?.velocity?.local_group?.e_v?.toFixed(2) || "NULL", | ||
| "Error unit": schema.units.velocity?.local_group?.e_v || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "CMB (old)", | ||
| Value: object.catalogs?.velocity?.cmb_old?.v?.toFixed(2) || "NULL", | ||
| Unit: schema.units.velocity?.cmb_old?.v || "NULL", | ||
| Error: object.catalogs?.velocity?.cmb_old?.e_v?.toFixed(2) || "NULL", | ||
| "Error unit": schema.units.velocity?.cmb_old?.e_v || "NULL", | ||
| }, | ||
| { | ||
| Parameter: "CMB", | ||
| Value: object.catalogs?.velocity?.cmb?.v?.toFixed(2) || "NULL", | ||
| Unit: schema.units.velocity?.cmb?.v || "NULL", | ||
| Error: object.catalogs?.velocity?.cmb?.e_v?.toFixed(2) || "NULL", | ||
| "Error unit": schema.units.velocity?.cmb?.e_v || "NULL", | ||
| }, | ||
| ]; | ||
| if (catalogs?.coordinates) { | ||
| data.push( | ||
| { | ||
| Parameter: "Equatorial RA", | ||
| Value: formatValueWithError( | ||
| catalogs.coordinates.equatorial?.ra, | ||
| catalogs.coordinates.equatorial?.e_ra, | ||
| schema.units.coordinates?.equatorial?.ra, | ||
| 2, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "Equatorial Dec", | ||
| Value: formatValueWithError( | ||
| catalogs.coordinates.equatorial?.dec, | ||
| catalogs.coordinates.equatorial?.e_dec, | ||
| schema.units.coordinates?.equatorial?.dec, | ||
| 2, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "Galactic l", | ||
| Value: formatValueWithError( | ||
| catalogs.coordinates.galactic?.lon, | ||
| catalogs.coordinates.galactic?.e_lon, | ||
| schema.units.coordinates?.galactic?.lon, | ||
| 2, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "Galactic b", | ||
| Value: formatValueWithError( | ||
| catalogs.coordinates.galactic?.lat, | ||
| catalogs.coordinates.galactic?.e_lat, | ||
| schema.units.coordinates?.galactic?.lat, | ||
| 2, | ||
| ), | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="space-y-6"> | ||
| {object.catalogs?.coordinates && ( | ||
| <CommonTable columns={coordinatesColumns} data={coordinatesData}> | ||
| <h2 className="text-xl font-bold">Coordinates</h2> | ||
| <p className="text-gray-300">Celestial coordinates of the object</p> | ||
| </CommonTable> | ||
| )} | ||
| if (catalogs?.redshift) { | ||
| data.push({ | ||
| Parameter: "Redshift z", | ||
| Value: formatValueWithError( | ||
| catalogs.redshift.z, | ||
| catalogs.redshift.e_z, | ||
| undefined, | ||
| 5, | ||
| ), | ||
| }); | ||
| } | ||
|
|
||
| {object.catalogs?.redshift && ( | ||
| <CommonTable columns={redshiftColumns} data={redshiftData}> | ||
| <h2 className="text-xl font-bold">Redshift</h2> | ||
| <p className="text-gray-300">Redshift measurements</p> | ||
| </CommonTable> | ||
| )} | ||
| if (catalogs?.velocity) { | ||
| data.push( | ||
| { | ||
| Parameter: "Heliocentric Velocity", | ||
| Value: formatValueWithError( | ||
| catalogs.velocity.heliocentric?.v, | ||
| catalogs.velocity.heliocentric?.e_v, | ||
| schema.units.velocity?.heliocentric?.v, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "Local Group Velocity", | ||
| Value: formatValueWithError( | ||
| catalogs.velocity.local_group?.v, | ||
| catalogs.velocity.local_group?.e_v, | ||
| schema.units.velocity?.local_group?.v, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "CMB (old) Velocity", | ||
| Value: formatValueWithError( | ||
| catalogs.velocity.cmb_old?.v, | ||
| catalogs.velocity.cmb_old?.e_v, | ||
| schema.units.velocity?.cmb_old?.v, | ||
| ), | ||
| }, | ||
| { | ||
| Parameter: "CMB Velocity", | ||
| Value: formatValueWithError( | ||
| catalogs.velocity.cmb?.v, | ||
| catalogs.velocity.cmb?.e_v, | ||
| schema.units.velocity?.cmb?.v, | ||
| ), | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| {object.catalogs?.velocity && ( | ||
| <CommonTable columns={velocityColumns} data={velocityData}> | ||
| <h2 className="text-xl font-bold">Velocity</h2> | ||
| <p className="text-gray-300"> | ||
| Velocity measurements with respect to different apexes | ||
| </p> | ||
| </CommonTable> | ||
| )} | ||
| </div> | ||
| ); | ||
| return <CommonTable columns={columns} data={data} />; | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.