Remove share path references
This commit is contained in:
parent
0ad1a519a4
commit
bc5efad5ca
@ -4,23 +4,14 @@ import {
|
|||||||
getPathComponents,
|
getPathComponents,
|
||||||
isPathCamera,
|
isPathCamera,
|
||||||
isPathCameraPhoto,
|
isPathCameraPhoto,
|
||||||
isPathCameraPhotoShare,
|
|
||||||
isPathCameraShare,
|
|
||||||
isPathFilmSimulation,
|
isPathFilmSimulation,
|
||||||
isPathFilmSimulationPhoto,
|
isPathFilmSimulationPhoto,
|
||||||
isPathFilmSimulationPhotoShare,
|
|
||||||
isPathFilmSimulationShare,
|
|
||||||
isPathFocalLength,
|
isPathFocalLength,
|
||||||
isPathFocalLengthPhoto,
|
isPathFocalLengthPhoto,
|
||||||
isPathFocalLengthPhotoShare,
|
|
||||||
isPathFocalLengthShare,
|
|
||||||
isPathPhoto,
|
isPathPhoto,
|
||||||
isPathPhotoShare,
|
|
||||||
isPathProtected,
|
isPathProtected,
|
||||||
isPathTag,
|
isPathTag,
|
||||||
isPathTagPhoto,
|
isPathTagPhoto,
|
||||||
isPathTagPhotoShare,
|
|
||||||
isPathTagShare,
|
|
||||||
} from '@/site/paths';
|
} from '@/site/paths';
|
||||||
import { TAG_HIDDEN } from '@/tag';
|
import { TAG_HIDDEN } from '@/tag';
|
||||||
|
|
||||||
@ -32,7 +23,6 @@ const CAMERA_OBJECT = { make: CAMERA_MAKE, model: CAMERA_MODEL };
|
|||||||
const FILM_SIMULATION = 'acros';
|
const FILM_SIMULATION = 'acros';
|
||||||
const FOCAL_LENGTH = 90;
|
const FOCAL_LENGTH = 90;
|
||||||
const FOCAL_LENGTH_STRING = `${FOCAL_LENGTH}mm`;
|
const FOCAL_LENGTH_STRING = `${FOCAL_LENGTH}mm`;
|
||||||
const SHARE = 'share';
|
|
||||||
|
|
||||||
const PATH_ROOT = '/';
|
const PATH_ROOT = '/';
|
||||||
const PATH_GRID = '/grid';
|
const PATH_GRID = '/grid';
|
||||||
@ -43,32 +33,21 @@ const PATH_OG_ALL = `${PATH_OG}/all`;
|
|||||||
const PATH_OG_SAMPLE = `${PATH_OG}/sample`;
|
const PATH_OG_SAMPLE = `${PATH_OG}/sample`;
|
||||||
|
|
||||||
const PATH_PHOTO = `/p/${PHOTO_ID}`;
|
const PATH_PHOTO = `/p/${PHOTO_ID}`;
|
||||||
const PATH_PHOTO_SHARE = `${PATH_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
const PATH_TAG = `/tag/${TAG}`;
|
const PATH_TAG = `/tag/${TAG}`;
|
||||||
const PATH_TAG_SHARE = `${PATH_TAG}/${SHARE}`;
|
|
||||||
const PATH_TAG_PHOTO = `${PATH_TAG}/${PHOTO_ID}`;
|
const PATH_TAG_PHOTO = `${PATH_TAG}/${PHOTO_ID}`;
|
||||||
const PATH_TAG_PHOTO_SHARE = `${PATH_TAG_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
const PATH_TAG_HIDDEN = `/tag/${TAG_HIDDEN}`;
|
const PATH_TAG_HIDDEN = `/tag/${TAG_HIDDEN}`;
|
||||||
const PATH_TAG_HIDDEN_SHARE = `${PATH_TAG_HIDDEN}/${SHARE}`;
|
|
||||||
const PATH_TAG_HIDDEN_PHOTO = `${PATH_TAG_HIDDEN}/${PHOTO_ID}`;
|
const PATH_TAG_HIDDEN_PHOTO = `${PATH_TAG_HIDDEN}/${PHOTO_ID}`;
|
||||||
const PATH_TAG_HIDDEN_PHOTO_SHARE = `${PATH_TAG_HIDDEN_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
const PATH_CAMERA = `/shot-on/${CAMERA_MAKE}/${CAMERA_MODEL}`;
|
const PATH_CAMERA = `/shot-on/${CAMERA_MAKE}/${CAMERA_MODEL}`;
|
||||||
const PATH_CAMERA_SHARE = `${PATH_CAMERA}/${SHARE}`;
|
|
||||||
const PATH_CAMERA_PHOTO = `${PATH_CAMERA}/${PHOTO_ID}`;
|
const PATH_CAMERA_PHOTO = `${PATH_CAMERA}/${PHOTO_ID}`;
|
||||||
const PATH_CAMERA_PHOTO_SHARE = `${PATH_CAMERA_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
const PATH_FILM_SIMULATION = `/film/${FILM_SIMULATION}`;
|
const PATH_FILM_SIMULATION = `/film/${FILM_SIMULATION}`;
|
||||||
const PATH_FILM_SIMULATION_SHARE = `${PATH_FILM_SIMULATION}/${SHARE}`;
|
|
||||||
const PATH_FILM_SIMULATION_PHOTO = `${PATH_FILM_SIMULATION}/${PHOTO_ID}`;
|
const PATH_FILM_SIMULATION_PHOTO = `${PATH_FILM_SIMULATION}/${PHOTO_ID}`;
|
||||||
const PATH_FILM_SIMULATION_PHOTO_SHARE = `${PATH_FILM_SIMULATION_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
const PATH_FOCAL_LENGTH = `/focal/${FOCAL_LENGTH_STRING}`;
|
const PATH_FOCAL_LENGTH = `/focal/${FOCAL_LENGTH_STRING}`;
|
||||||
const PATH_FOCAL_LENGTH_SHARE = `${PATH_FOCAL_LENGTH}/${SHARE}`;
|
|
||||||
const PATH_FOCAL_LENGTH_PHOTO = `${PATH_FOCAL_LENGTH}/${PHOTO_ID}`;
|
const PATH_FOCAL_LENGTH_PHOTO = `${PATH_FOCAL_LENGTH}/${PHOTO_ID}`;
|
||||||
const PATH_FOCAL_LENGTH_PHOTO_SHARE = `${PATH_FOCAL_LENGTH_PHOTO}/${SHARE}`;
|
|
||||||
|
|
||||||
describe('Paths', () => {
|
describe('Paths', () => {
|
||||||
it('can be protected', () => {
|
it('can be protected', () => {
|
||||||
@ -85,49 +64,22 @@ describe('Paths', () => {
|
|||||||
expect(isPathProtected(PATH_OG_ALL)).toBe(true);
|
expect(isPathProtected(PATH_OG_ALL)).toBe(true);
|
||||||
expect(isPathProtected(PATH_OG_SAMPLE)).toBe(true);
|
expect(isPathProtected(PATH_OG_SAMPLE)).toBe(true);
|
||||||
expect(isPathProtected(PATH_TAG_HIDDEN)).toBe(true);
|
expect(isPathProtected(PATH_TAG_HIDDEN)).toBe(true);
|
||||||
expect(isPathProtected(PATH_TAG_HIDDEN_SHARE)).toBe(true);
|
|
||||||
expect(isPathProtected(PATH_TAG_HIDDEN_PHOTO)).toBe(true);
|
expect(isPathProtected(PATH_TAG_HIDDEN_PHOTO)).toBe(true);
|
||||||
expect(isPathProtected(PATH_TAG_HIDDEN_PHOTO_SHARE)).toBe(true);
|
|
||||||
});
|
});
|
||||||
it('can be classified', () => {
|
it('can be classified', () => {
|
||||||
// Positive
|
// Positive
|
||||||
expect(isPathPhoto(PATH_PHOTO)).toBe(true);
|
expect(isPathPhoto(PATH_PHOTO)).toBe(true);
|
||||||
expect(isPathPhotoShare(PATH_PHOTO_SHARE)).toBe(true);
|
|
||||||
expect(isPathTag(PATH_TAG)).toBe(true);
|
expect(isPathTag(PATH_TAG)).toBe(true);
|
||||||
expect(isPathTagShare(PATH_TAG_SHARE)).toBe(true);
|
|
||||||
expect(isPathTagPhoto(PATH_TAG_PHOTO)).toBe(true);
|
expect(isPathTagPhoto(PATH_TAG_PHOTO)).toBe(true);
|
||||||
expect(isPathTagPhotoShare(PATH_TAG_PHOTO_SHARE)).toBe(true);
|
|
||||||
expect(isPathCamera(PATH_CAMERA)).toBe(true);
|
expect(isPathCamera(PATH_CAMERA)).toBe(true);
|
||||||
expect(isPathCameraShare(PATH_CAMERA_SHARE)).toBe(true);
|
|
||||||
expect(isPathCameraPhoto(PATH_CAMERA_PHOTO)).toBe(true);
|
expect(isPathCameraPhoto(PATH_CAMERA_PHOTO)).toBe(true);
|
||||||
expect(isPathCameraPhotoShare(PATH_CAMERA_PHOTO_SHARE)).toBe(true);
|
|
||||||
expect(isPathFilmSimulation(PATH_FILM_SIMULATION)).toBe(true);
|
expect(isPathFilmSimulation(PATH_FILM_SIMULATION)).toBe(true);
|
||||||
expect(isPathFilmSimulationShare(PATH_FILM_SIMULATION_SHARE)).toBe(true);
|
|
||||||
expect(isPathFilmSimulationPhoto(PATH_FILM_SIMULATION_PHOTO)).toBe(true);
|
expect(isPathFilmSimulationPhoto(PATH_FILM_SIMULATION_PHOTO)).toBe(true);
|
||||||
expect(isPathFilmSimulationPhotoShare(PATH_FILM_SIMULATION_PHOTO_SHARE)).toBe(true);
|
|
||||||
expect(isPathFocalLength(PATH_FOCAL_LENGTH)).toBe(true);
|
expect(isPathFocalLength(PATH_FOCAL_LENGTH)).toBe(true);
|
||||||
expect(isPathFocalLengthShare(PATH_FOCAL_LENGTH_SHARE)).toBe(true);
|
|
||||||
expect(isPathFocalLengthPhoto(PATH_FOCAL_LENGTH_PHOTO)).toBe(true);
|
expect(isPathFocalLengthPhoto(PATH_FOCAL_LENGTH_PHOTO)).toBe(true);
|
||||||
expect(isPathFocalLengthPhotoShare(PATH_FOCAL_LENGTH_PHOTO_SHARE)).toBe(true);
|
|
||||||
// Negative
|
// Negative
|
||||||
expect(isPathPhoto(PATH_TAG_PHOTO_SHARE)).toBe(false);
|
|
||||||
expect(isPathPhotoShare(PATH_TAG_PHOTO)).toBe(false);
|
|
||||||
expect(isPathTag(PATH_TAG_SHARE)).toBe(false);
|
|
||||||
expect(isPathTagShare(PATH_TAG)).toBe(false);
|
|
||||||
expect(isPathTagPhoto(PATH_PHOTO_SHARE)).toBe(false);
|
|
||||||
expect(isPathTagPhotoShare(PATH_PHOTO)).toBe(false);
|
|
||||||
expect(isPathCamera(PATH_TAG_SHARE)).toBe(false);
|
|
||||||
expect(isPathCameraShare(PATH_TAG)).toBe(false);
|
|
||||||
expect(isPathCameraPhoto(PATH_PHOTO_SHARE)).toBe(false);
|
|
||||||
expect(isPathCameraPhotoShare(PATH_PHOTO)).toBe(false);
|
|
||||||
expect(isPathFilmSimulation(PATH_TAG_SHARE)).toBe(false);
|
|
||||||
expect(isPathFilmSimulationShare(PATH_TAG)).toBe(false);
|
|
||||||
expect(isPathFilmSimulationPhoto(PATH_PHOTO_SHARE)).toBe(false);
|
|
||||||
expect(isPathFilmSimulationPhotoShare(PATH_PHOTO)).toBe(false);
|
|
||||||
expect(isPathFocalLength(PATH_FILM_SIMULATION)).toBe(false);
|
expect(isPathFocalLength(PATH_FILM_SIMULATION)).toBe(false);
|
||||||
expect(isPathFocalLengthShare(PATH_FILM_SIMULATION_SHARE)).toBe(false);
|
|
||||||
expect(isPathFocalLengthPhoto(PATH_FILM_SIMULATION_PHOTO)).toBe(false);
|
expect(isPathFocalLengthPhoto(PATH_FILM_SIMULATION_PHOTO)).toBe(false);
|
||||||
expect(isPathFocalLengthPhotoShare(PATH_FILM_SIMULATION_PHOTO_SHARE)).toBe(false);
|
|
||||||
});
|
});
|
||||||
it('can be parsed', () => {
|
it('can be parsed', () => {
|
||||||
// Core
|
// Core
|
||||||
@ -135,69 +87,38 @@ describe('Paths', () => {
|
|||||||
expect(getPathComponents(PATH_PHOTO)).toEqual({
|
expect(getPathComponents(PATH_PHOTO)).toEqual({
|
||||||
photoId: PHOTO_ID,
|
photoId: PHOTO_ID,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_PHOTO_SHARE)).toEqual({
|
|
||||||
photoId: PHOTO_ID,
|
|
||||||
});
|
|
||||||
// Tag
|
// Tag
|
||||||
expect(getPathComponents(PATH_TAG)).toEqual({
|
expect(getPathComponents(PATH_TAG)).toEqual({
|
||||||
tag: TAG,
|
tag: TAG,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_TAG_SHARE)).toEqual({
|
|
||||||
tag: TAG,
|
|
||||||
});
|
|
||||||
expect(getPathComponents(PATH_TAG_PHOTO)).toEqual({
|
expect(getPathComponents(PATH_TAG_PHOTO)).toEqual({
|
||||||
photoId: PHOTO_ID,
|
photoId: PHOTO_ID,
|
||||||
tag: TAG,
|
tag: TAG,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_TAG_PHOTO_SHARE)).toEqual({
|
|
||||||
photoId: PHOTO_ID,
|
|
||||||
tag: TAG,
|
|
||||||
});
|
|
||||||
// Camera
|
// Camera
|
||||||
expect(getPathComponents(PATH_CAMERA)).toEqual({
|
expect(getPathComponents(PATH_CAMERA)).toEqual({
|
||||||
camera: CAMERA_OBJECT,
|
camera: CAMERA_OBJECT,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_CAMERA_SHARE)).toEqual({
|
|
||||||
camera: CAMERA_OBJECT,
|
|
||||||
});
|
|
||||||
expect(getPathComponents(PATH_CAMERA_PHOTO)).toEqual({
|
expect(getPathComponents(PATH_CAMERA_PHOTO)).toEqual({
|
||||||
photoId: PHOTO_ID,
|
photoId: PHOTO_ID,
|
||||||
camera: CAMERA_OBJECT,
|
camera: CAMERA_OBJECT,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_CAMERA_PHOTO_SHARE)).toEqual({
|
|
||||||
photoId: PHOTO_ID,
|
|
||||||
camera: CAMERA_OBJECT,
|
|
||||||
});
|
|
||||||
// Film Simulation
|
// Film Simulation
|
||||||
expect(getPathComponents(PATH_FILM_SIMULATION)).toEqual({
|
expect(getPathComponents(PATH_FILM_SIMULATION)).toEqual({
|
||||||
simulation: FILM_SIMULATION,
|
simulation: FILM_SIMULATION,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_FILM_SIMULATION_SHARE)).toEqual({
|
|
||||||
simulation: FILM_SIMULATION,
|
|
||||||
});
|
|
||||||
expect(getPathComponents(PATH_FILM_SIMULATION_PHOTO)).toEqual({
|
expect(getPathComponents(PATH_FILM_SIMULATION_PHOTO)).toEqual({
|
||||||
photoId: PHOTO_ID,
|
photoId: PHOTO_ID,
|
||||||
simulation: FILM_SIMULATION,
|
simulation: FILM_SIMULATION,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_FILM_SIMULATION_PHOTO_SHARE)).toEqual({
|
|
||||||
photoId: PHOTO_ID,
|
|
||||||
simulation: FILM_SIMULATION,
|
|
||||||
});
|
|
||||||
// Focal Length
|
// Focal Length
|
||||||
expect(getPathComponents(PATH_FOCAL_LENGTH)).toEqual({
|
expect(getPathComponents(PATH_FOCAL_LENGTH)).toEqual({
|
||||||
focal: FOCAL_LENGTH,
|
focal: FOCAL_LENGTH,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_FOCAL_LENGTH_SHARE)).toEqual({
|
|
||||||
focal: FOCAL_LENGTH,
|
|
||||||
});
|
|
||||||
expect(getPathComponents(PATH_FOCAL_LENGTH_PHOTO)).toEqual({
|
expect(getPathComponents(PATH_FOCAL_LENGTH_PHOTO)).toEqual({
|
||||||
photoId: PHOTO_ID,
|
photoId: PHOTO_ID,
|
||||||
focal: FOCAL_LENGTH,
|
focal: FOCAL_LENGTH,
|
||||||
});
|
});
|
||||||
expect(getPathComponents(PATH_FOCAL_LENGTH_PHOTO_SHARE)).toEqual({
|
|
||||||
photoId: PHOTO_ID,
|
|
||||||
focal: FOCAL_LENGTH,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('can be escaped', () => {
|
it('can be escaped', () => {
|
||||||
// Root
|
// Root
|
||||||
@ -207,26 +128,17 @@ describe('Paths', () => {
|
|||||||
expect(getEscapePath(PATH_ADMIN)).toEqual(undefined);
|
expect(getEscapePath(PATH_ADMIN)).toEqual(undefined);
|
||||||
// Photo
|
// Photo
|
||||||
expect(getEscapePath(PATH_PHOTO)).toEqual(PATH_ROOT);
|
expect(getEscapePath(PATH_PHOTO)).toEqual(PATH_ROOT);
|
||||||
expect(getEscapePath(PATH_PHOTO_SHARE)).toEqual(PATH_PHOTO);
|
|
||||||
// Tag
|
// Tag
|
||||||
expect(getEscapePath(PATH_TAG)).toEqual(PATH_ROOT);
|
expect(getEscapePath(PATH_TAG)).toEqual(PATH_ROOT);
|
||||||
expect(getEscapePath(PATH_TAG_SHARE)).toEqual(PATH_TAG);
|
|
||||||
expect(getEscapePath(PATH_TAG_PHOTO)).toEqual(PATH_TAG);
|
expect(getEscapePath(PATH_TAG_PHOTO)).toEqual(PATH_TAG);
|
||||||
expect(getEscapePath(PATH_TAG_PHOTO_SHARE)).toEqual(PATH_TAG_PHOTO);
|
|
||||||
// Camera
|
// Camera
|
||||||
expect(getEscapePath(PATH_CAMERA)).toEqual(PATH_ROOT);
|
expect(getEscapePath(PATH_CAMERA)).toEqual(PATH_ROOT);
|
||||||
expect(getEscapePath(PATH_CAMERA_SHARE)).toEqual(PATH_CAMERA);
|
|
||||||
expect(getEscapePath(PATH_CAMERA_PHOTO)).toEqual(PATH_CAMERA);
|
expect(getEscapePath(PATH_CAMERA_PHOTO)).toEqual(PATH_CAMERA);
|
||||||
expect(getEscapePath(PATH_CAMERA_PHOTO_SHARE)).toEqual(PATH_CAMERA_PHOTO);
|
|
||||||
// Film Simulation
|
// Film Simulation
|
||||||
expect(getEscapePath(PATH_FILM_SIMULATION)).toEqual(PATH_ROOT);
|
expect(getEscapePath(PATH_FILM_SIMULATION)).toEqual(PATH_ROOT);
|
||||||
expect(getEscapePath(PATH_FILM_SIMULATION_SHARE)).toEqual(PATH_FILM_SIMULATION);
|
|
||||||
expect(getEscapePath(PATH_FILM_SIMULATION_PHOTO)).toEqual(PATH_FILM_SIMULATION);
|
expect(getEscapePath(PATH_FILM_SIMULATION_PHOTO)).toEqual(PATH_FILM_SIMULATION);
|
||||||
expect(getEscapePath(PATH_FILM_SIMULATION_PHOTO_SHARE)).toEqual(PATH_FILM_SIMULATION_PHOTO);
|
|
||||||
// Focal Length
|
// Focal Length
|
||||||
expect(getEscapePath(PATH_FOCAL_LENGTH)).toEqual(PATH_ROOT);
|
expect(getEscapePath(PATH_FOCAL_LENGTH)).toEqual(PATH_ROOT);
|
||||||
expect(getEscapePath(PATH_FOCAL_LENGTH_SHARE)).toEqual(PATH_FOCAL_LENGTH);
|
|
||||||
expect(getEscapePath(PATH_FOCAL_LENGTH_PHOTO)).toEqual(PATH_FOCAL_LENGTH);
|
expect(getEscapePath(PATH_FOCAL_LENGTH_PHOTO)).toEqual(PATH_FOCAL_LENGTH);
|
||||||
expect(getEscapePath(PATH_FOCAL_LENGTH_PHOTO_SHARE)).toEqual(PATH_FOCAL_LENGTH_PHOTO);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Photo, PhotoDateRange } from '@/photo';
|
import { Photo, PhotoDateRange } from '@/photo';
|
||||||
import { pathForCameraShare } from '@/site/paths';
|
|
||||||
import PhotoHeader from '@/photo/PhotoHeader';
|
import PhotoHeader from '@/photo/PhotoHeader';
|
||||||
import { Camera, cameraFromPhoto } from '.';
|
import { Camera, cameraFromPhoto } from '.';
|
||||||
import PhotoCamera from './PhotoCamera';
|
import PhotoCamera from './PhotoCamera';
|
||||||
@ -29,10 +28,10 @@ export default function CameraHeader({
|
|||||||
descriptionForCameraPhotos(photos, undefined, count, dateRange)}
|
descriptionForCameraPhotos(photos, undefined, count, dateRange)}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
selectedPhoto={selectedPhoto}
|
selectedPhoto={selectedPhoto}
|
||||||
sharePath={pathForCameraShare(camera)}
|
|
||||||
indexNumber={indexNumber}
|
indexNumber={indexNumber}
|
||||||
count={count}
|
count={count}
|
||||||
dateRange={dateRange}
|
dateRange={dateRange}
|
||||||
|
includeShareButton
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Photo, PhotoDateRange } from '@/photo';
|
import { Photo, PhotoDateRange } from '@/photo';
|
||||||
import { descriptionForFocalLengthPhotos } from '.';
|
import { descriptionForFocalLengthPhotos } from '.';
|
||||||
import { pathForFocalLengthShare } from '@/site/paths';
|
|
||||||
import PhotoHeader from '@/photo/PhotoHeader';
|
import PhotoHeader from '@/photo/PhotoHeader';
|
||||||
import PhotoFocalLength from './PhotoFocalLength';
|
import PhotoFocalLength from './PhotoFocalLength';
|
||||||
|
|
||||||
@ -30,10 +29,10 @@ export default function FocalLengthHeader({
|
|||||||
)}
|
)}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
selectedPhoto={selectedPhoto}
|
selectedPhoto={selectedPhoto}
|
||||||
sharePath={pathForFocalLengthShare(focal)}
|
|
||||||
indexNumber={indexNumber}
|
indexNumber={indexNumber}
|
||||||
count={count}
|
count={count}
|
||||||
dateRange={dateRange}
|
dateRange={dateRange}
|
||||||
|
includeShareButton
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,20 +27,20 @@ export default function PhotoHeader({
|
|||||||
entity,
|
entity,
|
||||||
entityVerb = 'PHOTO',
|
entityVerb = 'PHOTO',
|
||||||
entityDescription,
|
entityDescription,
|
||||||
sharePath,
|
|
||||||
indexNumber,
|
indexNumber,
|
||||||
count,
|
count,
|
||||||
dateRange,
|
dateRange,
|
||||||
|
includeShareButton,
|
||||||
}: {
|
}: {
|
||||||
photos: Photo[]
|
photos: Photo[]
|
||||||
selectedPhoto?: Photo
|
selectedPhoto?: Photo
|
||||||
entity?: ReactNode
|
entity?: ReactNode
|
||||||
entityVerb?: string
|
entityVerb?: string
|
||||||
entityDescription?: string
|
entityDescription?: string
|
||||||
sharePath?: string
|
|
||||||
indexNumber?: number
|
indexNumber?: number
|
||||||
count?: number
|
count?: number
|
||||||
dateRange?: PhotoDateRange
|
dateRange?: PhotoDateRange
|
||||||
|
includeShareButton?: boolean
|
||||||
} & PhotoSetCategory) {
|
} & PhotoSetCategory) {
|
||||||
const { isGridHighDensity } = useAppState();
|
const { isGridHighDensity } = useAppState();
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ export default function PhotoHeader({
|
|||||||
{headerType === 'photo-set'
|
{headerType === 'photo-set'
|
||||||
? <>
|
? <>
|
||||||
{entityDescription}
|
{entityDescription}
|
||||||
{sharePath &&
|
{includeShareButton &&
|
||||||
<ShareButton
|
<ShareButton
|
||||||
photos={photos}
|
photos={photos}
|
||||||
tag={tag}
|
tag={tag}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Photo, PhotoDateRange } from '@/photo';
|
import { Photo, PhotoDateRange } from '@/photo';
|
||||||
import { FilmSimulation, descriptionForFilmSimulationPhotos } from '.';
|
import { FilmSimulation, descriptionForFilmSimulationPhotos } from '.';
|
||||||
import { pathForFilmSimulationShare } from '@/site/paths';
|
|
||||||
import PhotoHeader from '@/photo/PhotoHeader';
|
import PhotoHeader from '@/photo/PhotoHeader';
|
||||||
import PhotoFilmSimulation from
|
import PhotoFilmSimulation from
|
||||||
'@/simulation/PhotoFilmSimulation';
|
'@/simulation/PhotoFilmSimulation';
|
||||||
@ -28,10 +27,10 @@ export default function FilmSimulationHeader({
|
|||||||
photos, undefined, count, dateRange)}
|
photos, undefined, count, dateRange)}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
selectedPhoto={selectedPhoto}
|
selectedPhoto={selectedPhoto}
|
||||||
sharePath={pathForFilmSimulationShare(simulation)}
|
|
||||||
indexNumber={indexNumber}
|
indexNumber={indexNumber}
|
||||||
count={count}
|
count={count}
|
||||||
dateRange={dateRange}
|
dateRange={dateRange}
|
||||||
|
includeShareButton
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,6 @@ export const PATH_API_VERCEL_BLOB_UPLOAD = `${PATH_API_STORAGE}/vercel-blob`;
|
|||||||
export const PATH_API_PRESIGNED_URL = `${PATH_API_STORAGE}/presigned-url`;
|
export const PATH_API_PRESIGNED_URL = `${PATH_API_STORAGE}/presigned-url`;
|
||||||
|
|
||||||
// Modifiers
|
// Modifiers
|
||||||
const SHARE = 'share';
|
|
||||||
const EDIT = 'edit';
|
const EDIT = 'edit';
|
||||||
|
|
||||||
export const PATHS_ADMIN = [
|
export const PATHS_ADMIN = [
|
||||||
@ -113,33 +112,18 @@ export const pathForPhoto = ({
|
|||||||
? `${pathForFocalLength(focal)}/${getPhotoId(photo)}`
|
? `${pathForFocalLength(focal)}/${getPhotoId(photo)}`
|
||||||
: `${PREFIX_PHOTO}/${getPhotoId(photo)}`;
|
: `${PREFIX_PHOTO}/${getPhotoId(photo)}`;
|
||||||
|
|
||||||
export const pathForPhotoShare = (params: PhotoPathParams) =>
|
|
||||||
`${pathForPhoto(params)}/${SHARE}`;
|
|
||||||
|
|
||||||
export const pathForTag = (tag: string) =>
|
export const pathForTag = (tag: string) =>
|
||||||
`${PREFIX_TAG}/${tag}`;
|
`${PREFIX_TAG}/${tag}`;
|
||||||
|
|
||||||
export const pathForTagShare = (tag: string) =>
|
|
||||||
`${pathForTag(tag)}/${SHARE}`;
|
|
||||||
|
|
||||||
export const pathForCamera = ({ make, model }: Camera) =>
|
export const pathForCamera = ({ make, model }: Camera) =>
|
||||||
`${PREFIX_CAMERA}/${parameterize(make, true)}/${parameterize(model, true)}`;
|
`${PREFIX_CAMERA}/${parameterize(make, true)}/${parameterize(model, true)}`;
|
||||||
|
|
||||||
export const pathForCameraShare = (camera: Camera) =>
|
|
||||||
`${pathForCamera(camera)}/${SHARE}`;
|
|
||||||
|
|
||||||
export const pathForFilmSimulation = (simulation: FilmSimulation) =>
|
export const pathForFilmSimulation = (simulation: FilmSimulation) =>
|
||||||
`${PREFIX_FILM_SIMULATION}/${simulation}`;
|
`${PREFIX_FILM_SIMULATION}/${simulation}`;
|
||||||
|
|
||||||
export const pathForFilmSimulationShare = (simulation: FilmSimulation) =>
|
|
||||||
`${pathForFilmSimulation(simulation)}/${SHARE}`;
|
|
||||||
|
|
||||||
export const pathForFocalLength = (focal: number) =>
|
export const pathForFocalLength = (focal: number) =>
|
||||||
`${PREFIX_FOCAL_LENGTH}/${focal}mm`;
|
`${PREFIX_FOCAL_LENGTH}/${focal}mm`;
|
||||||
|
|
||||||
export const pathForFocalLengthShare = (focal: number) =>
|
|
||||||
`${pathForFocalLength(focal)}/${SHARE}`;;
|
|
||||||
|
|
||||||
export const absolutePathForPhoto = (params: PhotoPathParams) =>
|
export const absolutePathForPhoto = (params: PhotoPathParams) =>
|
||||||
`${BASE_URL}${pathForPhoto(params)}`;
|
`${BASE_URL}${pathForPhoto(params)}`;
|
||||||
|
|
||||||
@ -176,76 +160,38 @@ export const absolutePathForFocalLengthImage =
|
|||||||
export const isPathPhoto = (pathname = '') =>
|
export const isPathPhoto = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_PHOTO}/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_PHOTO}/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// p/[photoId]/share
|
|
||||||
export const isPathPhotoShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_PHOTO}/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// tag/[tag]
|
// tag/[tag]
|
||||||
export const isPathTag = (pathname = '') =>
|
export const isPathTag = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_TAG}/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_TAG}/[^/]+/?$`).test(pathname);;
|
||||||
|
|
||||||
// tag/[tag]/share
|
|
||||||
export const isPathTagShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_TAG}/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// tag/[tag]/[photoId]
|
// tag/[tag]/[photoId]
|
||||||
export const isPathTagPhoto = (pathname = '') =>
|
export const isPathTagPhoto = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_TAG}/[^/]+/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_TAG}/[^/]+/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// tag/[tag]/[photoId]/share
|
|
||||||
export const isPathTagPhotoShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_TAG}/[^/]+/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// shot-on/[make]/[model]
|
// shot-on/[make]/[model]
|
||||||
export const isPathCamera = (pathname = '') =>
|
export const isPathCamera = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// shot-on/[make]/[model]/share
|
|
||||||
export const isPathCameraShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// shot-on/[make]/[model]/[photoId]
|
// shot-on/[make]/[model]/[photoId]
|
||||||
export const isPathCameraPhoto = (pathname = '') =>
|
export const isPathCameraPhoto = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// shot-on/[make]/[model]/[photoId]/share
|
|
||||||
export const isPathCameraPhotoShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// film/[simulation]
|
// film/[simulation]
|
||||||
export const isPathFilmSimulation = (pathname = '') =>
|
export const isPathFilmSimulation = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// film/[simulation]/share
|
|
||||||
export const isPathFilmSimulationShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// film/[simulation]/[photoId]
|
// film/[simulation]/[photoId]
|
||||||
export const isPathFilmSimulationPhoto = (pathname = '') =>
|
export const isPathFilmSimulationPhoto = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// film/[simulation]/[photoId]/share
|
|
||||||
export const isPathFilmSimulationPhotoShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/[^/]+/${SHARE}/?$`)
|
|
||||||
.test(pathname);
|
|
||||||
|
|
||||||
// focal/[focal]
|
// focal/[focal]
|
||||||
export const isPathFocalLength = (pathname = '') =>
|
export const isPathFocalLength = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// focal/[focal]/share
|
|
||||||
export const isPathFocalLengthShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/${SHARE}/?$`).test(pathname);
|
|
||||||
|
|
||||||
// focal/[focal]/[photoId]
|
// focal/[focal]/[photoId]
|
||||||
export const isPathFocalLengthPhoto = (pathname = '') =>
|
export const isPathFocalLengthPhoto = (pathname = '') =>
|
||||||
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/[^/]+/?$`).test(pathname);
|
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/[^/]+/?$`).test(pathname);
|
||||||
|
|
||||||
// focal/[focal]/[photoId]/share
|
|
||||||
export const isPathFocalLengthPhotoShare = (pathname = '') =>
|
|
||||||
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[^/]+/[^/]+/${SHARE}/?$`)
|
|
||||||
.test(pathname);
|
|
||||||
|
|
||||||
export const checkPathPrefix = (pathname = '', prefix: string) =>
|
export const checkPathPrefix = (pathname = '', prefix: string) =>
|
||||||
pathname.toLowerCase().startsWith(prefix);
|
pathname.toLowerCase().startsWith(prefix);
|
||||||
|
|
||||||
@ -278,13 +224,13 @@ export const getPathComponents = (pathname = ''): {
|
|||||||
const photoIdFromPhoto = pathname.match(
|
const photoIdFromPhoto = pathname.match(
|
||||||
new RegExp(`^${PREFIX_PHOTO}/([^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_PHOTO}/([^/]+)`))?.[1];
|
||||||
const photoIdFromTag = pathname.match(
|
const photoIdFromTag = pathname.match(
|
||||||
new RegExp(`^${PREFIX_TAG}/[^/]+/((?!${SHARE})[^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_TAG}/[^/]+/([^/]+)`))?.[1];
|
||||||
const photoIdFromCamera = pathname.match(
|
const photoIdFromCamera = pathname.match(
|
||||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/((?!${SHARE})[^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/([^/]+)`))?.[1];
|
||||||
const photoIdFromFilmSimulation = pathname.match(
|
const photoIdFromFilmSimulation = pathname.match(
|
||||||
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/((?!${SHARE})[^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_FILM_SIMULATION}/[^/]+/([^/]+)`))?.[1];
|
||||||
const photoIdFromFocalLength = pathname.match(
|
const photoIdFromFocalLength = pathname.match(
|
||||||
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[0-9]+mm/((?!${SHARE})[^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_FOCAL_LENGTH}/[0-9]+mm/([^/]+)`))?.[1];
|
||||||
const tag = pathname.match(
|
const tag = pathname.match(
|
||||||
new RegExp(`^${PREFIX_TAG}/([^/]+)`))?.[1];
|
new RegExp(`^${PREFIX_TAG}/([^/]+)`))?.[1];
|
||||||
const cameraMake = pathname.match(
|
const cameraMake = pathname.match(
|
||||||
@ -334,35 +280,13 @@ export const getEscapePath = (pathname?: string) => {
|
|||||||
(focal && isPathFocalLength(pathname))
|
(focal && isPathFocalLength(pathname))
|
||||||
) {
|
) {
|
||||||
return PATH_ROOT;
|
return PATH_ROOT;
|
||||||
} else if (photoId && isPathTagPhotoShare(pathname)) {
|
} else if (tag && isPathTagPhoto(pathname)) {
|
||||||
return pathForPhoto({ photo: photoId, tag });
|
|
||||||
} else if (photoId && isPathCameraPhotoShare(pathname)) {
|
|
||||||
return pathForPhoto({ photo: photoId, camera });
|
|
||||||
} else if (photoId && isPathFilmSimulationPhotoShare(pathname)) {
|
|
||||||
return pathForPhoto({ photo: photoId, simulation });
|
|
||||||
} else if (photoId && isPathFocalLengthPhotoShare(pathname)) {
|
|
||||||
return pathForPhoto({ photo: photoId, focal });
|
|
||||||
} else if (photoId && isPathPhotoShare(pathname)) {
|
|
||||||
return pathForPhoto({ photo: photoId });
|
|
||||||
} else if (tag && (
|
|
||||||
isPathTagPhoto(pathname) ||
|
|
||||||
isPathTagShare(pathname)
|
|
||||||
)) {
|
|
||||||
return pathForTag(tag);
|
return pathForTag(tag);
|
||||||
} else if (camera && (
|
} else if (camera && isPathCameraPhoto(pathname)) {
|
||||||
isPathCameraPhoto(pathname) ||
|
|
||||||
isPathCameraShare(pathname)
|
|
||||||
)) {
|
|
||||||
return pathForCamera(camera);
|
return pathForCamera(camera);
|
||||||
} else if (simulation && (
|
} else if (simulation && isPathFilmSimulationPhoto(pathname)) {
|
||||||
isPathFilmSimulationPhoto(pathname) ||
|
|
||||||
isPathFilmSimulationShare(pathname)
|
|
||||||
)) {
|
|
||||||
return pathForFilmSimulation(simulation);
|
return pathForFilmSimulation(simulation);
|
||||||
} else if (focal && (
|
} else if (focal && isPathFocalLengthPhoto(pathname)) {
|
||||||
isPathFocalLengthPhoto(pathname) ||
|
|
||||||
isPathFocalLengthShare(pathname)
|
|
||||||
)) {
|
|
||||||
return pathForFocalLength(focal);
|
return pathForFocalLength(focal);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Photo, PhotoDateRange } from '@/photo';
|
import { Photo, PhotoDateRange } from '@/photo';
|
||||||
import PhotoTag from './PhotoTag';
|
import PhotoTag from './PhotoTag';
|
||||||
import { descriptionForTaggedPhotos, isTagFavs } from '.';
|
import { descriptionForTaggedPhotos, isTagFavs } from '.';
|
||||||
import { pathForTagShare } from '@/site/paths';
|
|
||||||
import PhotoHeader from '@/photo/PhotoHeader';
|
import PhotoHeader from '@/photo/PhotoHeader';
|
||||||
import FavsTag from './FavsTag';
|
import FavsTag from './FavsTag';
|
||||||
|
|
||||||
@ -30,10 +29,10 @@ export default function TagHeader({
|
|||||||
entityDescription={descriptionForTaggedPhotos(photos, undefined, count)}
|
entityDescription={descriptionForTaggedPhotos(photos, undefined, count)}
|
||||||
photos={photos}
|
photos={photos}
|
||||||
selectedPhoto={selectedPhoto}
|
selectedPhoto={selectedPhoto}
|
||||||
sharePath={pathForTagShare(tag)}
|
|
||||||
indexNumber={indexNumber}
|
indexNumber={indexNumber}
|
||||||
count={count}
|
count={count}
|
||||||
dateRange={dateRange}
|
dateRange={dateRange}
|
||||||
|
includeShareButton
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user