This commit is contained in:
+171
-103
@@ -79,126 +79,141 @@
|
||||
border: 2px solid $borderColor;
|
||||
border-radius: $borderRadius;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cover-photo {
|
||||
position: relative;
|
||||
height: 350px;
|
||||
flex: 0 0 350px;
|
||||
margin-bottom: 3px;
|
||||
cursor: pointer;
|
||||
.cover-photo {
|
||||
position: relative;
|
||||
height: 350px;
|
||||
flex: 0 0 350px;
|
||||
margin-bottom: 3px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
border-radius: $borderRadius;
|
||||
box-shadow: #333 5px 5px 5px;
|
||||
overflow: hidden;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
border-radius: $borderRadius;
|
||||
box-shadow: #333 5px 5px 5px;
|
||||
overflow: hidden;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
img,
|
||||
svg {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.file-name {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
line-height: 1.2em;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
&.cover-photo--no-img {
|
||||
//padding-left: calc(350px / 2 - 37.5px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
#page-loader {
|
||||
padding: 9px;
|
||||
}
|
||||
|
||||
svg.no-photos {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
color: $accentColor;
|
||||
}
|
||||
&:hover {
|
||||
img,
|
||||
svg {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.card-details {
|
||||
flex: 1 1 auto;
|
||||
margin-left: 25px;
|
||||
margin-top: 25px;
|
||||
|
||||
@media(max-width: 968px) {
|
||||
margin-left: 0;
|
||||
width: 100%;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.input-element {
|
||||
margin-bottom: 25px;
|
||||
|
||||
.input-error {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
bottom: -1.4em;
|
||||
left: 25px;
|
||||
font-size: 11pt;
|
||||
color: red;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
.file-name {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
line-height: 1.2em;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.input-buttons {
|
||||
&.cover-photo--no-img {
|
||||
//padding-left: calc(350px / 2 - 37.5px);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
#page-loader {
|
||||
padding: 9px;
|
||||
}
|
||||
|
||||
svg.no-photos {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
color: $accentColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-details {
|
||||
flex: 1 1 auto;
|
||||
margin-left: 25px;
|
||||
margin-top: 25px;
|
||||
|
||||
@media(max-width: 968px) {
|
||||
margin-left: 0;
|
||||
width: 100%;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
&.card-details--flex {
|
||||
flex: 0 0 100%;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.card-details-left {
|
||||
flex: 0 0 50%;
|
||||
}
|
||||
|
||||
.card-details-right {
|
||||
flex: 0 0 50%;
|
||||
}
|
||||
|
||||
.input-element {
|
||||
margin-bottom: 25px;
|
||||
|
||||
.input-error {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
bottom: -1.4em;
|
||||
left: 25px;
|
||||
font-size: 11pt;
|
||||
color: red;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-buttons {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@media(max-width: 968px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.left-buttons {
|
||||
display: flex;
|
||||
|
||||
button {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
@media(max-width: 968px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.left-buttons {
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
button {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
@media(max-width: 968px) {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
button {
|
||||
margin-right: 0;
|
||||
}
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right-buttons {
|
||||
display: flex;
|
||||
.right-buttons {
|
||||
display: flex;
|
||||
|
||||
button {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
@media(max-width: 968px) {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
|
||||
button {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
@media(max-width: 968px) {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
|
||||
button {
|
||||
margin-left: 0;
|
||||
}
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,4 +254,57 @@
|
||||
font-size: 1rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.pos--rel {
|
||||
position: relative;
|
||||
}
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.pad {
|
||||
padding: 15px;
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.border {
|
||||
border: 2px solid $borderColor;
|
||||
}
|
||||
|
||||
.border--round {
|
||||
border-radius: $borderRadius;
|
||||
}
|
||||
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.flex--vert {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex--vert-sm {
|
||||
@media(max-width: 768px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.flex--align-center-sm {
|
||||
@media(max-width: 768px) {
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.flex--stretch {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex--align-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
@@ -15,10 +15,10 @@ import '@fontsource/roboto/500.css';
|
||||
import '@fontsource/roboto/700.css';
|
||||
|
||||
import Keycloak from "./services/authentication/keycloak";
|
||||
import PortfolioManager from "./pages/portfolio-manager";
|
||||
import AlbumManager from "./pages/album-manager";
|
||||
import InstanceAlbumsPage from "./pages/instance-albums-page";
|
||||
import AlbumPage from "./pages/album-page";
|
||||
import {InstancesPage} from "./pages/instances-page";
|
||||
import {NoAccessPage} from "./pages/no-access";
|
||||
import {NoAccessPage} from "./pages/no-access-page";
|
||||
import {InstancesProvider} from "./services/instances/instances-context";
|
||||
import {AdminLayout} from "./layout";
|
||||
import {Home} from "@mui/icons-material";
|
||||
@@ -37,8 +37,8 @@ const router = createBrowserRouter(
|
||||
<Route path="albums/*" element={<Outlet />} handle={{
|
||||
crumb: (routeData) => <Link to={`/${routeData?.params?.instanceId}/albums`}>albums</Link>
|
||||
}}>
|
||||
<Route index element={<PortfolioManager/>} />
|
||||
<Route path=":albumId" element={<AlbumManager/>} handle={{
|
||||
<Route index element={<InstanceAlbumsPage/>} />
|
||||
<Route path=":albumId" element={<AlbumPage />} handle={{
|
||||
crumb: (routeData) => <Link to={`/${routeData?.params?.instanceId}/albums/${routeData.params.albumId}`}>{routeData.params.albumId}</Link>
|
||||
}}/>
|
||||
</Route>
|
||||
|
||||
@@ -7,6 +7,7 @@ export class Instance {
|
||||
this.title = instance?.title;
|
||||
this.subtitle = instance?.subtitle;
|
||||
this.coverPhoto = instance?.coverPhoto ? new Photo(instance.coverPhoto) : null;
|
||||
this.homeLayout = instance?.homeLayout;
|
||||
this.urls = instance?.urls?.map(u => u) || [];
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ import DragAndDrop from "../components/drag-and-drop/drag-and-drop";
|
||||
import {Album} from "../models/album";
|
||||
import Loader from "../components/Loader";
|
||||
|
||||
import "./album-manager.scss";
|
||||
import "./album-page.scss";
|
||||
import {useInstances} from "../services/instances/use-instances";
|
||||
|
||||
function AlbumManager() {
|
||||
function AlbumPage() {
|
||||
const {state} = useLocation();
|
||||
const {album} = state; // Read values passed on state
|
||||
const {selectedInstance} = useInstances();
|
||||
@@ -299,4 +299,4 @@ function AlbumManager() {
|
||||
</div>;
|
||||
}
|
||||
|
||||
export default AlbumManager;
|
||||
export default AlbumPage;
|
||||
+3
-3
@@ -13,10 +13,10 @@ import Loader from "../components/Loader";
|
||||
import {Button, TextField} from "@mui/material";
|
||||
import {Album} from "../models/album";
|
||||
|
||||
import "./portfolio-manager.scss"
|
||||
import "./instance-albums-page.scss"
|
||||
import {useInstances} from "../services/instances/use-instances";
|
||||
|
||||
function PortfolioManager() {
|
||||
function InstanceAlbumsPage() {
|
||||
const navigate = useNavigate();
|
||||
const {selectedInstance} = useInstances();
|
||||
|
||||
@@ -208,4 +208,4 @@ function PortfolioManager() {
|
||||
</div>
|
||||
}
|
||||
|
||||
export default PortfolioManager;
|
||||
export default InstanceAlbumsPage;
|
||||
@@ -6,8 +6,7 @@ import {useAuth} from "../services/authentication/use-auth";
|
||||
import {useInstances} from "../services/instances/use-instances";
|
||||
import {Instance} from "../models/instance";
|
||||
import {
|
||||
AddAPhoto, AddCircle,
|
||||
ArrowRightAltOutlined, Edit, RemoveCircle
|
||||
AddAPhoto, AddCircle, ArrowRightAltOutlined, Edit, RadioButtonChecked, RadioButtonUnchecked, RemoveCircle
|
||||
} from "@mui/icons-material";
|
||||
|
||||
import "./instances-page.scss";
|
||||
@@ -16,12 +15,7 @@ import DragAndDrop from "../components/drag-and-drop/drag-and-drop";
|
||||
export function InstancesPage() {
|
||||
const navigate = useNavigate();
|
||||
const {
|
||||
instances,
|
||||
createInstance,
|
||||
deleteInstance,
|
||||
updateInstance,
|
||||
uploadCoverPhoto,
|
||||
instanceApiError
|
||||
instances, createInstance, deleteInstance, updateInstance, uploadCoverPhoto, instanceApiError
|
||||
} = useInstances();
|
||||
const [instancesToUpdate, setInstancesToUpdate] = useState(null);
|
||||
const {userData} = useAuth();
|
||||
@@ -59,9 +53,10 @@ export function InstancesPage() {
|
||||
}
|
||||
|
||||
const instanceHasChanges = (idx) => {
|
||||
return (instancesToUpdate[idx].title || "") !== (instances[idx]?.title || "") ||
|
||||
(instancesToUpdate[idx].subtitle || "") !== (instances[idx]?.subtitle || "") ||
|
||||
JSON.stringify(instancesToUpdate[idx].urls) !== JSON.stringify(instances[idx]?.urls);
|
||||
return (instancesToUpdate[idx].title || "") !== (instances[idx]?.title || "")
|
||||
|| (instancesToUpdate[idx].subtitle || "") !== (instances[idx]?.subtitle || "")
|
||||
|| JSON.stringify(instancesToUpdate[idx].urls) !== JSON.stringify(instances[idx]?.urls)
|
||||
|| instancesToUpdate[idx].homeLayout !== instances[idx]?.homeLayout;
|
||||
}
|
||||
const handleCreateInstance = async () => {
|
||||
await createInstance(new Instance({
|
||||
@@ -92,7 +87,20 @@ export function InstancesPage() {
|
||||
const handleDrop = async (e, idx) => {
|
||||
await handleFiles(e, idx)
|
||||
}
|
||||
|
||||
const handleSelectLayout = (idx, layout) => {
|
||||
instancesToUpdate[idx].homeLayout = layout;
|
||||
setInstancesToUpdate([...instancesToUpdate]);
|
||||
}
|
||||
const homeLayouts = [{
|
||||
id: 1,
|
||||
name: "Layout 1"
|
||||
}, {
|
||||
id: 2,
|
||||
name: "Layout 2"
|
||||
}, {
|
||||
id: 3,
|
||||
name: "Layout 3"
|
||||
}]
|
||||
return <div id="instance-selector-page">
|
||||
<div id="page-title">
|
||||
<div id="left-part">
|
||||
@@ -120,87 +128,101 @@ export function InstancesPage() {
|
||||
</>}
|
||||
</div>
|
||||
<div id="instance-list">
|
||||
{instancesToUpdate?.map((instance, idx) =>
|
||||
<div className="card-layout instance" key={instance.instanceId}>
|
||||
<div
|
||||
className={`${idx} cover-photo ${(!isUploading[idx] && instance.coverPhoto ? "" : "cover-photo--no-img")}`}>
|
||||
<DragAndDrop onDrop={(e) => handleDrop(e, idx)}
|
||||
onClick={(e) => fileInputRefs.current[idx].click(e)}
|
||||
isLoading={isUploading[idx]}>
|
||||
{!isUploading[idx] && instance.coverPhoto
|
||||
? <>
|
||||
<img src={`${instance.coverPhoto.url}?width=450&height=450&fit=cover`}
|
||||
alt={instance.coverPhoto.name}/>
|
||||
<div className="btn-edit-photo"><Edit /></div>
|
||||
</>
|
||||
: <AddAPhoto className="no-photos"/>
|
||||
}
|
||||
</DragAndDrop>
|
||||
<input type="file" id={`photosUpload`} ref={(element) => fileInputRefs.current[idx] = element}
|
||||
accept="image/*"
|
||||
onChange={(e) => handleFiles(e, idx)}></input>
|
||||
</div>
|
||||
<div className="card-details">
|
||||
<div className="title input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.title}
|
||||
placeholder="Title..."
|
||||
onChange={(e) => handleInstanceTitleChange(e, idx)}
|
||||
/>
|
||||
</div>
|
||||
<div className="description input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.subtitle || ""}
|
||||
placeholder="Subtitle..."
|
||||
onChange={(e) => handleInstanceSubtitleChange(e, idx)}
|
||||
/>
|
||||
</div>
|
||||
<div className="url input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.newInstanceUrl || ""}
|
||||
placeholder="https://my-photos.be"
|
||||
onChange={(e) => handleNewInstanceUrlChange(e, idx)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
{instancesToUpdate?.map((instance, idx) => <div
|
||||
className="pad flex flex--stretch flex--align-start border border--round instance"
|
||||
key={instance.instanceId}>
|
||||
<div
|
||||
className={`${idx} cover-photo ${(!isUploading[idx] && instance.coverPhoto ? "" : "cover-photo--no-img")}`}>
|
||||
<DragAndDrop onDrop={(e) => handleDrop(e, idx)}
|
||||
onClick={(e) => fileInputRefs.current[idx].click(e)}
|
||||
isLoading={isUploading[idx]}>
|
||||
{!isUploading[idx] && instance.coverPhoto ? <>
|
||||
<img src={`${instance.coverPhoto.url}?width=450&height=450&fit=cover`}
|
||||
alt={instance.coverPhoto.name}/>
|
||||
<div className="btn-edit-photo"><Edit/></div>
|
||||
</> : <AddAPhoto className="no-photos"/>}
|
||||
</DragAndDrop>
|
||||
<input type="file" id={`photosUpload`} ref={(element) => fileInputRefs.current[idx] = element}
|
||||
accept="image/*"
|
||||
onChange={(e) => handleFiles(e, idx)}></input>
|
||||
</div>
|
||||
<div className="card-details">
|
||||
<div className="flex flex--align-start flex--vert-sm flex--align-center-sm">
|
||||
<div className="card-details-left">
|
||||
<div className="title input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.title}
|
||||
placeholder="Title..."
|
||||
onChange={(e) => handleInstanceTitleChange(e, idx)}
|
||||
/>
|
||||
</div>
|
||||
<div className="description input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.subtitle || ""}
|
||||
placeholder="Subtitle..."
|
||||
onChange={(e) => handleInstanceSubtitleChange(e, idx)}
|
||||
/>
|
||||
</div>
|
||||
<div className="url input-element">
|
||||
<TextField fullWidth={true} variant="standard"
|
||||
value={instance.newInstanceUrl || ""}
|
||||
placeholder="https://my-photos.be"
|
||||
onChange={(e) => handleNewInstanceUrlChange(e, idx)}
|
||||
InputProps={{
|
||||
endAdornment: (<InputAdornment position="end">
|
||||
<IconButton color="warning"
|
||||
onClick={(e) => handleAddNewInstanceUrl(e, idx)}>
|
||||
<AddCircle/>
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
)
|
||||
}}/>
|
||||
<div className="instance-links">
|
||||
{instance.urls.map(url => <div className="instance-link" key={url}>
|
||||
<IconButton color="error" onClick={(e) => handleDeleteUrl(e, idx, url)}>
|
||||
<RemoveCircle/>
|
||||
</IconButton>
|
||||
<NavLink to={url}>{url}</NavLink>
|
||||
</div>)}
|
||||
</InputAdornment>)
|
||||
}}/>
|
||||
<div className="instance-links">
|
||||
{instance.urls.map(url => <div className="instance-link" key={url}>
|
||||
<IconButton color="error" onClick={(e) => handleDeleteUrl(e, idx, url)}>
|
||||
<RemoveCircle/>
|
||||
</IconButton>
|
||||
<NavLink to={url}>{url}</NavLink>
|
||||
</div>)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-buttons">
|
||||
<div className="left-buttons">
|
||||
<Button className="photo-save" variant="contained" color="error"
|
||||
onClick={(e) => handleDeleteInstance(e, instance.instanceId)}>
|
||||
Delete
|
||||
</Button>
|
||||
<Button className="photo-save" variant="contained" color="info"
|
||||
disabled={!instanceHasChanges(idx)}
|
||||
onClick={() => handleSaveInstance(idx)}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
<div className="right-buttons">
|
||||
<Button className="photo-save" variant="contained" color="info"
|
||||
onClick={() => navigate(`/${instance.instanceId}`)}>
|
||||
Albums <ArrowRightAltOutlined/>
|
||||
</Button>
|
||||
<div className="card-details-right">
|
||||
<div className="flex flex--vert flex--align-start pad">
|
||||
<span className="inline-block bold">Home layout:</span>
|
||||
<div className="flex flex--vert pad">
|
||||
{homeLayouts.map(layout =>
|
||||
<div key={layout.id} className="flex pointer" onClick={() => handleSelectLayout(idx, layout.id)}>
|
||||
<span>{instance.homeLayout === layout.id ? <RadioButtonChecked/> :
|
||||
<RadioButtonUnchecked/>}
|
||||
</span>
|
||||
<span> {layout.name}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-buttons">
|
||||
<div className="left-buttons">
|
||||
<Button className="photo-save" variant="contained" color="error"
|
||||
onClick={(e) => handleDeleteInstance(e, instance.instanceId)}>
|
||||
Delete
|
||||
</Button>
|
||||
<Button className="photo-save" variant="contained" color="info"
|
||||
disabled={!instanceHasChanges(idx)}
|
||||
onClick={() => handleSaveInstance(idx)}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
<div className="right-buttons">
|
||||
<Button className="photo-save" variant="contained" color="info"
|
||||
onClick={() => navigate(`/${instance.instanceId}`)}>
|
||||
Manage <ArrowRightAltOutlined/>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>)}
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
@@ -13,9 +13,11 @@
|
||||
img {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.btn-edit-photo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.btn-edit-photo {
|
||||
position: absolute;
|
||||
@@ -27,6 +29,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
|
||||
svg {
|
||||
color: white;
|
||||
font-size: 48px;
|
||||
@@ -70,5 +73,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user