Add upload page and move styles to shared assets

This commit is contained in:
Alan Grainger
2026-10-06 11:14:36 +13:00
parent 95ac498cf0
commit 242d716f7b
9 changed files with 788 additions and 91 deletions
+38 -10
View File
@@ -1,4 +1,5 @@
import { jsonForInlineScript, ThemeScript } from '@ipp/core'
import { ICON_ARROW_LEFT, ICON_CLOUD_UPLOAD } from '../shared/icons'
import { UPLOAD_ACCEPT, UploadPageConfig } from '../shared/upload'
import { ASSET_VERSION } from '../version'
@@ -10,7 +11,19 @@ export interface UploadPageProps {
galleryLink?: string
}
/** The upload page for one share: the share title, the picker, and the list the client fills. */
function Icon ({ path, class: className }: { path: string, class?: string }) {
return (
<svg viewBox="0 0 24 24" aria-hidden="true" class={className}>
<path fill="currentColor" d={path}/>
</svg>
)
}
/**
* The upload page for one share, in the look of Immich's own upload UI: the
* gallery's header, a placeholder to click or drop on, and an upload panel
* the client fills.
*/
export function UploadPage ({ config, basePath, galleryLink }: UploadPageProps) {
const staticPath = `${basePath}/share/static/${ASSET_VERSION}`
return (
@@ -19,25 +32,40 @@ export function UploadPage ({ config, basePath, galleryLink }: UploadPageProps)
<ThemeScript/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="robots" content="noindex"/>
<title>{'Send photos to ' + config.title}</title>
<title>{'Add photos to ' + config.title}</title>
<link rel="icon" href={basePath + '/share/static/favicon.ico'} type="image/x-icon"/>
<link type="text/css" rel="stylesheet" href={staticPath + '/pico.min.css'}/>
<link type="text/css" rel="stylesheet" href={staticPath + '/theme.css'}/>
<link type="text/css" rel="stylesheet" href={staticPath + '/style.css'}/>
</head>
<body>
<main class="container upload-page">
<h1>Send photos to <em>{config.title}</em></h1>
<button id="upload-choose" type="button" class="upload-choose">Choose photos</button>
<header id="header">
{galleryLink && (
<a class="header-action" href={galleryLink} title="Back to gallery" aria-label="Back to gallery">
<Icon path={ICON_ARROW_LEFT}/>
</a>
)}
<div class="header-text">
<h1>{config.title}</h1>
<p class="subtitle">Add photos and videos</p>
</div>
</header>
<main id="upload-main">
<button id="upload-choose" type="button" class="upload-placeholder">
<Icon path={ICON_CLOUD_UPLOAD} class="upload-placeholder-icon"/>
<span class="upload-placeholder-title">Add photos</span>
<span class="upload-placeholder-text">Choose photos and videos<span class="upload-drop-hint">, or drop them here</span></span>
</button>
<input id="upload-input" type="file" multiple accept={UPLOAD_ACCEPT} hidden/>
{galleryLink && <p><a class="upload-back" href={galleryLink}>Back to gallery</a></p>}
<section id="upload-batch" hidden aria-live="polite">
<h2 id="upload-status"></h2>
<section id="upload-panel" hidden aria-live="polite" aria-label="Uploads">
<p id="upload-progress"></p>
<p id="upload-counts"></p>
<p id="upload-note" hidden>New photos appear in the gallery once Immich has processed them.</p>
<ul id="upload-list"></ul>
</section>
</main>
<div id="upload-drop" hidden>
<p>Drop to send photos to <em>{config.title}</em></p>
<Icon path={ICON_CLOUD_UPLOAD} class="upload-drop-icon"/>
<p>Drop files to upload</p>
</div>
<script type="application/json" id="upload-init" dangerouslySetInnerHTML={{ __html: jsonForInlineScript(config) }}/>
<script type="module" src={staticPath + '/js/client/upload.js'}></script>