diff --git a/ui/package.json b/ui/package.json index ab0dbc6b..4df4166f 100644 --- a/ui/package.json +++ b/ui/package.json @@ -63,7 +63,7 @@ "lint:types": "tsc --noemit", "jest": "craco test --setupFilesAfterEnv ./testing/setupTests.ts", "jest:ci": "CI=true craco test --setupFilesAfterEnv ./testing/setupTests.ts --verbose --ci --coverage", - "genSchemaTypes": "apollo client:codegen --target=typescript --globalTypesFile=src/__generated__/globalTypes.ts", + "genSchemaTypes": "apollo client:codegen --target=typescript --globalTypesFile=src/__generated__/globalTypes.ts && prettier --write */**/__generated__/*.ts", "extractTranslations": "i18next -c i18next-parser.config.js", "prepare": "(cd .. && npx husky install)" }, diff --git a/ui/src/Pages/SharePage/SharePage.tsx b/ui/src/Pages/SharePage/SharePage.tsx index e07d4c14..15ab3601 100644 --- a/ui/src/Pages/SharePage/SharePage.tsx +++ b/ui/src/Pages/SharePage/SharePage.tsx @@ -59,6 +59,10 @@ export const SHARE_TOKEN_QUERY = gql` focalLength flash exposureProgram + coordinates { + longitude + latitude + } } } } diff --git a/ui/src/Pages/SharePage/__generated__/SharePageToken.ts b/ui/src/Pages/SharePage/__generated__/SharePageToken.ts index 0891fc71..e454c8b7 100644 --- a/ui/src/Pages/SharePage/__generated__/SharePageToken.ts +++ b/ui/src/Pages/SharePage/__generated__/SharePageToken.ts @@ -3,172 +3,188 @@ // @generated // This file was automatically generated and should not be edited. -import { MediaType } from "./../../../__generated__/globalTypes"; +import { MediaType } from './../../../__generated__/globalTypes' // ==================================================== // GraphQL query operation: SharePageToken // ==================================================== export interface SharePageToken_shareToken_album { - __typename: "Album"; - id: string; + __typename: 'Album' + id: string } export interface SharePageToken_shareToken_media_thumbnail { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number } export interface SharePageToken_shareToken_media_downloads_mediaUrl { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number /** * The file size of the resource in bytes */ - fileSize: number; + fileSize: number } export interface SharePageToken_shareToken_media_downloads { - __typename: "MediaDownload"; - title: string; - mediaUrl: SharePageToken_shareToken_media_downloads_mediaUrl; + __typename: 'MediaDownload' + title: string + mediaUrl: SharePageToken_shareToken_media_downloads_mediaUrl } export interface SharePageToken_shareToken_media_highRes { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number } export interface SharePageToken_shareToken_media_videoWeb { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number +} + +export interface SharePageToken_shareToken_media_exif_coordinates { + __typename: 'Coordinates' + /** + * GPS longitude in degrees + */ + longitude: number + /** + * GPS latitude in degrees + */ + latitude: number } export interface SharePageToken_shareToken_media_exif { - __typename: "MediaEXIF"; - id: string; + __typename: 'MediaEXIF' + id: string /** * The model name of the camera */ - camera: string | null; + camera: string | null /** * The maker of the camera */ - maker: string | null; + maker: string | null /** * The name of the lens */ - lens: string | null; - dateShot: any | null; + lens: string | null + dateShot: any | null /** * The exposure time of the image */ - exposure: number | null; + exposure: number | null /** * The aperature stops of the image */ - aperture: number | null; + aperture: number | null /** * The ISO setting of the image */ - iso: number | null; + iso: number | null /** * The focal length of the lens, when the image was taken */ - focalLength: number | null; + focalLength: number | null /** * A formatted description of the flash settings, when the image was taken */ - flash: number | null; + flash: number | null /** * An index describing the mode for adjusting the exposure of the image */ - exposureProgram: number | null; + exposureProgram: number | null + /** + * GPS coordinates of where the image was taken + */ + coordinates: SharePageToken_shareToken_media_exif_coordinates | null } export interface SharePageToken_shareToken_media { - __typename: "Media"; - id: string; - title: string; - type: MediaType; + __typename: 'Media' + id: string + title: string + type: MediaType /** * URL to display the media in a smaller resolution */ - thumbnail: SharePageToken_shareToken_media_thumbnail | null; - downloads: SharePageToken_shareToken_media_downloads[]; + thumbnail: SharePageToken_shareToken_media_thumbnail | null + downloads: SharePageToken_shareToken_media_downloads[] /** * URL to display the photo in full resolution, will be null for videos */ - highRes: SharePageToken_shareToken_media_highRes | null; + highRes: SharePageToken_shareToken_media_highRes | null /** * URL to get the video in a web format that can be played in the browser, will be null for photos */ - videoWeb: SharePageToken_shareToken_media_videoWeb | null; - exif: SharePageToken_shareToken_media_exif | null; + videoWeb: SharePageToken_shareToken_media_videoWeb | null + exif: SharePageToken_shareToken_media_exif | null } export interface SharePageToken_shareToken { - __typename: "ShareToken"; - token: string; + __typename: 'ShareToken' + token: string /** * The album this token shares */ - album: SharePageToken_shareToken_album | null; + album: SharePageToken_shareToken_album | null /** * The media this token shares */ - media: SharePageToken_shareToken_media | null; + media: SharePageToken_shareToken_media | null } export interface SharePageToken { - shareToken: SharePageToken_shareToken; + shareToken: SharePageToken_shareToken } export interface SharePageTokenVariables { - token: string; - password?: string | null; + token: string + password?: string | null } diff --git a/ui/src/components/__generated__/albumPathQuery.ts b/ui/src/components/__generated__/albumPathQuery.ts index 258c5861..6d141f5d 100644 --- a/ui/src/components/__generated__/albumPathQuery.ts +++ b/ui/src/components/__generated__/albumPathQuery.ts @@ -8,15 +8,15 @@ // ==================================================== export interface albumPathQuery_album_path { - __typename: "Album"; - id: string; - title: string; + __typename: 'Album' + id: string + title: string } export interface albumPathQuery_album { - __typename: "Album"; - id: string; - path: albumPathQuery_album_path[]; + __typename: 'Album' + id: string + path: albumPathQuery_album_path[] } export interface albumPathQuery { @@ -24,9 +24,9 @@ export interface albumPathQuery { * Get album by id, user must own the album or be admin * If valid tokenCredentials are provided, the album may be retrived without further authentication */ - album: albumPathQuery_album; + album: albumPathQuery_album } export interface albumPathQueryVariables { - id: string; + id: string } diff --git a/ui/src/components/sidebar/MediaSidebar.tsx b/ui/src/components/sidebar/MediaSidebar.tsx index 9f0b8a3a..f19b3c0f 100644 --- a/ui/src/components/sidebar/MediaSidebar.tsx +++ b/ui/src/components/sidebar/MediaSidebar.tsx @@ -72,6 +72,10 @@ const SIDEBAR_MEDIA_QUERY = gql` focalLength flash exposureProgram + coordinates { + latitude + longitude + } } faces { id @@ -170,6 +174,13 @@ export const MetadataInfo = ({ media }: MediaInfoProps) => { exif.exposure = `1/${Math.round(1 / exif.exposure)}` } + const coordinates = media.exif.coordinates + if (!isNil(coordinates)) { + exif.coordinates = `${ + Math.round(coordinates.latitude * 1000000) / 1000000 + }, ${Math.round(coordinates.longitude * 1000000) / 1000000}` + } + const exposurePrograms = exposureProgramsLookup(t) if ( @@ -246,6 +257,7 @@ const exifNameLookup = (t: TranslationFn): { [key: string]: string } => ({ iso: t('sidebar.media.exif.name.iso', 'ISO'), focalLength: t('sidebar.media.exif.name.focal_length', 'Focal length'), flash: t('sidebar.media.exif.name.flash', 'Flash'), + coordinates: t('sidebar.media.exif.name.coordinates', 'Coordinates'), }) // From https://exiftool.org/TagNames/EXIF.html diff --git a/ui/src/components/sidebar/__generated__/sidebarPhoto.ts b/ui/src/components/sidebar/__generated__/sidebarPhoto.ts index 0dbad684..8d99075e 100644 --- a/ui/src/components/sidebar/__generated__/sidebarPhoto.ts +++ b/ui/src/components/sidebar/__generated__/sidebarPhoto.ts @@ -3,155 +3,171 @@ // @generated // This file was automatically generated and should not be edited. -import { MediaType } from "./../../../__generated__/globalTypes"; +import { MediaType } from './../../../__generated__/globalTypes' // ==================================================== // GraphQL query operation: sidebarPhoto // ==================================================== export interface sidebarPhoto_media_highRes { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number } export interface sidebarPhoto_media_thumbnail { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number } export interface sidebarPhoto_media_videoWeb { - __typename: "MediaURL"; + __typename: 'MediaURL' /** * URL for previewing the image */ - url: string; + url: string /** * Width of the image in pixels */ - width: number; + width: number /** * Height of the image in pixels */ - height: number; + height: number } export interface sidebarPhoto_media_videoMetadata { - __typename: "VideoMetadata"; - id: string; - width: number; - height: number; - duration: number; - codec: string | null; - framerate: number | null; - bitrate: string | null; - colorProfile: string | null; - audio: string | null; + __typename: 'VideoMetadata' + id: string + width: number + height: number + duration: number + codec: string | null + framerate: number | null + bitrate: string | null + colorProfile: string | null + audio: string | null +} + +export interface sidebarPhoto_media_exif_coordinates { + __typename: 'Coordinates' + /** + * GPS latitude in degrees + */ + latitude: number + /** + * GPS longitude in degrees + */ + longitude: number } export interface sidebarPhoto_media_exif { - __typename: "MediaEXIF"; - id: string; + __typename: 'MediaEXIF' + id: string /** * The model name of the camera */ - camera: string | null; + camera: string | null /** * The maker of the camera */ - maker: string | null; + maker: string | null /** * The name of the lens */ - lens: string | null; - dateShot: any | null; + lens: string | null + dateShot: any | null /** * The exposure time of the image */ - exposure: number | null; + exposure: number | null /** * The aperature stops of the image */ - aperture: number | null; + aperture: number | null /** * The ISO setting of the image */ - iso: number | null; + iso: number | null /** * The focal length of the lens, when the image was taken */ - focalLength: number | null; + focalLength: number | null /** * A formatted description of the flash settings, when the image was taken */ - flash: number | null; + flash: number | null /** * An index describing the mode for adjusting the exposure of the image */ - exposureProgram: number | null; + exposureProgram: number | null + /** + * GPS coordinates of where the image was taken + */ + coordinates: sidebarPhoto_media_exif_coordinates | null } export interface sidebarPhoto_media_faces_rectangle { - __typename: "FaceRectangle"; - minX: number; - maxX: number; - minY: number; - maxY: number; + __typename: 'FaceRectangle' + minX: number + maxX: number + minY: number + maxY: number } export interface sidebarPhoto_media_faces_faceGroup { - __typename: "FaceGroup"; - id: string; + __typename: 'FaceGroup' + id: string } export interface sidebarPhoto_media_faces { - __typename: "ImageFace"; - id: string; - rectangle: sidebarPhoto_media_faces_rectangle; - faceGroup: sidebarPhoto_media_faces_faceGroup; + __typename: 'ImageFace' + id: string + rectangle: sidebarPhoto_media_faces_rectangle + faceGroup: sidebarPhoto_media_faces_faceGroup } export interface sidebarPhoto_media { - __typename: "Media"; - id: string; - title: string; - type: MediaType; + __typename: 'Media' + id: string + title: string + type: MediaType /** * URL to display the photo in full resolution, will be null for videos */ - highRes: sidebarPhoto_media_highRes | null; + highRes: sidebarPhoto_media_highRes | null /** * URL to display the media in a smaller resolution */ - thumbnail: sidebarPhoto_media_thumbnail | null; + thumbnail: sidebarPhoto_media_thumbnail | null /** * URL to get the video in a web format that can be played in the browser, will be null for photos */ - videoWeb: sidebarPhoto_media_videoWeb | null; - videoMetadata: sidebarPhoto_media_videoMetadata | null; - exif: sidebarPhoto_media_exif | null; - faces: sidebarPhoto_media_faces[]; + videoWeb: sidebarPhoto_media_videoWeb | null + videoMetadata: sidebarPhoto_media_videoMetadata | null + exif: sidebarPhoto_media_exif | null + faces: sidebarPhoto_media_faces[] } export interface sidebarPhoto { @@ -159,9 +175,9 @@ export interface sidebarPhoto { * Get media by id, user must own the media or be admin. * If valid tokenCredentials are provided, the media may be retrived without further authentication */ - media: sidebarPhoto_media; + media: sidebarPhoto_media } export interface sidebarPhotoVariables { - id: string; + id: string } diff --git a/ui/src/components/timelineGallery/TimelineFilters.tsx b/ui/src/components/timelineGallery/TimelineFilters.tsx index 0884a270..1702550d 100644 --- a/ui/src/components/timelineGallery/TimelineFilters.tsx +++ b/ui/src/components/timelineGallery/TimelineFilters.tsx @@ -53,7 +53,9 @@ const DateSelector = ({ filterDate, setFilterDate }: DateSelectorProps) => { const yearItems = years.map(x => ({ value: `${x}`, - label: `${x} and earlier`, + label: t('timeline_filter.date.dropdown_year', '{{year}} and earlier', { + year: x, + }), })) items = [...items, ...yearItems] } diff --git a/ui/src/extractedTranslations/da/translation.json b/ui/src/extractedTranslations/da/translation.json index fe49443d..81209a00 100644 --- a/ui/src/extractedTranslations/da/translation.json +++ b/ui/src/extractedTranslations/da/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Blænde", "camera": "Kamera", + "coordinates": "Koordinater", "date_shot": "Dato", "exposure": "Lukketid", "exposure_program": "Lukketid program", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "Fra i dag", + "dropdown_year": "{{year}} og tidligere", "label": "Dato" } }, diff --git a/ui/src/extractedTranslations/de/translation.json b/ui/src/extractedTranslations/de/translation.json index ee94dd12..3db9459f 100644 --- a/ui/src/extractedTranslations/de/translation.json +++ b/ui/src/extractedTranslations/de/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Blende", "camera": "Kamera", + "coordinates": "", "date_shot": "Aufnahmedatum", "exposure": "Belichtung", "exposure_program": "Programm", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } }, diff --git a/ui/src/extractedTranslations/en/translation.json b/ui/src/extractedTranslations/en/translation.json index c64f063d..d2c759e6 100644 --- a/ui/src/extractedTranslations/en/translation.json +++ b/ui/src/extractedTranslations/en/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Aperture", "camera": "Camera", + "coordinates": "Coordinates", "date_shot": "Date shot", "exposure": "Exposure", "exposure_program": "Program", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "From today", + "dropdown_year": "{{year}} and earlier", "label": "Date" } }, diff --git a/ui/src/extractedTranslations/es/translation.json b/ui/src/extractedTranslations/es/translation.json index 7d1d0b7b..12357289 100644 --- a/ui/src/extractedTranslations/es/translation.json +++ b/ui/src/extractedTranslations/es/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Abertura", "camera": "Cámara", + "coordinates": "", "date_shot": "Fecha de captura", "exposure": "Exposición", "exposure_program": "Programa", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } }, diff --git a/ui/src/extractedTranslations/fr/translation.json b/ui/src/extractedTranslations/fr/translation.json index 64eb30c0..c5bcfb58 100644 --- a/ui/src/extractedTranslations/fr/translation.json +++ b/ui/src/extractedTranslations/fr/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Ouverture", "camera": "Modèle", + "coordinates": "", "date_shot": "Prise de vue", "exposure": "Vitesse", "exposure_program": "Programme", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "Depuis aujourd'hui", + "dropdown_year": "", "label": "Date" } }, diff --git a/ui/src/extractedTranslations/it/translation.json b/ui/src/extractedTranslations/it/translation.json index b64f070f..ce6b7309 100644 --- a/ui/src/extractedTranslations/it/translation.json +++ b/ui/src/extractedTranslations/it/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Apertura", "camera": "Fotocamera", + "coordinates": "", "date_shot": "Data di scatto", "exposure": "Esposizione", "exposure_program": "Programma", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } }, diff --git a/ui/src/extractedTranslations/pl/translation.json b/ui/src/extractedTranslations/pl/translation.json index 962ab269..3f26dd60 100644 --- a/ui/src/extractedTranslations/pl/translation.json +++ b/ui/src/extractedTranslations/pl/translation.json @@ -293,6 +293,7 @@ "name": { "aperture": "Przysłona", "camera": "Aparat ", + "coordinates": "", "date_shot": "Data wykonania", "exposure": "Ekspozycja", "exposure_program": "Program", @@ -324,6 +325,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } }, diff --git a/ui/src/extractedTranslations/ru/translation.json b/ui/src/extractedTranslations/ru/translation.json index d6b1530a..b4bfb795 100644 --- a/ui/src/extractedTranslations/ru/translation.json +++ b/ui/src/extractedTranslations/ru/translation.json @@ -293,6 +293,7 @@ "name": { "aperture": "Диафрагма", "camera": "Камера", + "coordinates": "", "date_shot": "Дата снимка", "exposure": "Экспозиция", "exposure_program": "Программа", @@ -324,6 +325,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } }, diff --git a/ui/src/extractedTranslations/sv/translation.json b/ui/src/extractedTranslations/sv/translation.json index 19c1aaec..c19ff9ac 100644 --- a/ui/src/extractedTranslations/sv/translation.json +++ b/ui/src/extractedTranslations/sv/translation.json @@ -288,6 +288,7 @@ "name": { "aperture": "Bländare", "camera": "Kamera", + "coordinates": "", "date_shot": "Datum tagen", "exposure": "Exponering", "exposure_program": "Program", @@ -319,6 +320,7 @@ "timeline_filter": { "date": { "dropdown_all": "", + "dropdown_year": "", "label": "" } },