mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Hiding port for /media link when there is no port. Using 'ago' popup for VideoPage date.
This commit is contained in:
parent
b643728b96
commit
79e88d1bc6
2 changed files with 7 additions and 4 deletions
|
|
@ -62,7 +62,8 @@ export const DEFAULT_LIMIT = 20;
|
|||
export const NAME = process.env && process.env.REACT_APP_NAME ? process.env.REACT_APP_NAME : null;
|
||||
|
||||
// Other services on a WROLPi.
|
||||
export const FILES_MEDIA_URI = `https://${window.location.hostname}:${window.location.port}/media/`;
|
||||
const port = window.location.port ? `${window.location.port}` : '';
|
||||
export const FILES_MEDIA_URI = `https://${window.location.hostname}${port}/media/`;
|
||||
export const MAP_VIEWER_URI = `https://${window.location.hostname}:8084`;
|
||||
export const ZIM_VIEWER_URI = `https://${window.location.hostname}:8085`;
|
||||
export const HELP_VIEWER_URI = `https://${window.location.hostname}:8086`;
|
||||
|
|
@ -1821,11 +1822,13 @@ export function useLocalStorage(key, initialValue, decode = JSON.parse, encode =
|
|||
|
||||
// Initialize state with the value from localStorage or initial value
|
||||
const [value, setValue] = useState(() => {
|
||||
let item;
|
||||
try {
|
||||
const item = window.localStorage.getItem(key);
|
||||
item = window.localStorage.getItem(key);
|
||||
// Parse the stored item (integer, bool, etc.). Use the initial value if empty.
|
||||
return item ? decode(item) : initialValue;
|
||||
} catch (error) {
|
||||
console.error('useLocalStorage', key, item, initialValue);
|
||||
console.error('Error reading localStorage:', error);
|
||||
return initialValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
encodeMediaPath,
|
||||
getParentDirectory,
|
||||
humanFileSize,
|
||||
humanNumber, isoDatetimeToElapsedPopup,
|
||||
humanNumber, isoDatetimeToAgoPopup,
|
||||
isoDatetimeToString,
|
||||
MultilineText,
|
||||
PageContainer,
|
||||
|
|
@ -367,7 +367,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
|
|||
<Segment>
|
||||
|
||||
<Header as='h2'>{title}</Header>
|
||||
{videoFile.published_datetime && <h3>{isoDatetimeToElapsedPopup(videoFile.published_datetime)}</h3>}
|
||||
{videoFile.published_datetime && <h3>{isoDatetimeToAgoPopup(videoFile.published_datetime)}</h3>}
|
||||
<h3>
|
||||
{channel && <Link to={`/videos/channel/${channel.id}/video`}>
|
||||
{channel.name}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue