0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

reject modernity, embrace tradition

This commit is contained in:
Víctor Losada Hernández
2024-01-27 14:31:32 +01:00
parent 89fddd0210
commit 8ce6b22be7
3 changed files with 60 additions and 165 deletions

View File

@@ -1,4 +1,5 @@
require('./archivePage.less');
const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
@@ -29,7 +30,6 @@ const ArchivePage = createClass({
};
},
componentDidMount : function() {
console.log(this.state.title);
this.lookup();
},
@@ -41,7 +41,7 @@ const ArchivePage = createClass({
this.setState({ searching: true, error: null });
request
.get(`/archive/${this.state.title}`)
.then((res) => this.setState({ brewCollection: res.body.brews }, this.setState({ limit: res.body.message})))
.then((res) => this.setState({ brewCollection: res.body.simplifiedBrews }, this.setState({ limit: res.body.message})))
.catch((err) => this.setState({ error: err }))
.finally(() => this.setState({ searching: false }));
},
@@ -61,6 +61,7 @@ const ArchivePage = createClass({
},
renderFoundBrews() {
const brews = this.state.brewCollection;
console.log('brews: ',brews);
if (!brews || brews.length === 0) {
return <div>No brews found.</div>;
@@ -125,6 +126,8 @@ const ArchivePage = createClass({
render: function () {
return (
<div className='archivePage'>
<link href='/themes/V3/Blank/style.css' rel='stylesheet'/>
<link href='/themes/V3/5ePHB/style.css' rel='stylesheet'/>
{this.renderNavItems()}
<div className='content'>

View File

@@ -28,7 +28,7 @@ body {
font-size: 40px;
font-weight: 900;
color: white;
filter: drop-shadow(0 0 5px black);
filter:drop-shadow(0 0 5px black);
}
}
@@ -66,9 +66,11 @@ body {
flex-direction: column;
border-left: 2px solid;
height: 100%;
font-family: "BookInsanityRemake";
font-size: .34cm;
.title {
height: 100px;
height: 10vh;
background-color: #333;
display: grid;
place-items: center;
@@ -79,189 +81,61 @@ body {
font-weight: 900;
}
}
.foundBrews {
position:relative;
position: relative;
background-color: #2C3E50;
display: flex;
flex-direction: column;
width: 100%;
min-height: 500px;
height: 100%;
max-height: 100%;
height: 66.7vh;
padding: 50px;
padding-bottom: unset;
overflow-y:scroll;
.limit {
position:fixed;
bottom:0;
left:502px;
position: fixed;
bottom: 0;
left: 502px;
font-size: 11px;
font-weight: 800;
color:white;
color: white;
background-color: #333;
padding: 8px 10px;
z-index: 1000;
&:has(p:empty) {
display:none;
display: none;
}
}
.brewItem {
height: 50px;
min-height: unset;
width: 100%;
display: flex;
color: white;
background: #707070;
overflow: visible;
.text {
min-height: unset;
width: 20vw;
padding-inline:10px;
height: 1.5em;
display: grid;
align-content: center;
h2 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 20px;
font-weight: 900;
}
background-image: url('/assets/parchmentBackground.jpg');
width: 48%;
margin-right: 40px;
&:nth-child(2n+1) {
margin-right: 0;
}
hr {
display: none;
h2 {
font-size: 0.75cm;
line-height: 0.988em;
font-family: "MrEavesRemake";
font-weight: 800;
color: var(--HB_Color_HeaderText);
}
.info {
width: 100%;
display: grid;
grid-template-areas: "tags authors views pages update storage";
justify-content: end;
align-content: space-around;
grid-template-columns: 3fr 150px 70px 70px 200px 50px;
br {
display: none;
}
.brewTags{
display:inline-block;
grid-area: tags;
}
[title*="Authors:"] {
display:inline-block;
grid-area: authors;
}
[title*="Last"] {
display:inline-block;
grid-area: views;
}
[title*="Page"] {
display:inline-block;
grid-area: pages;
}
[title*="Created"] {
display:inline-block;
grid-area: update;
}
[title*="Storage"] {
display:inline-block;
grid-area: storage;
filter:drop-shadow(0 0 10px white);
}
.brewTags {
padding-left: 10px;
}
font-family: ScalySansRemake;
font-size: 1.2em;
.brewTags:has(span:nth-of-type(4)) {
position: relative;
overflow: hidden;
display: flex;
flex-wrap: wrap;
span:nth-of-type(n+2) {
display: none;
}
&:hover {
overflow: visible;
position: absolute;
top: 0;
background:#707070;
height: max-content;
z-index: 100;
width:min-content;
padding:10px;
span:nth-of-type(n+4) {
display: block;
}
&:after {
position: absolute;
top: 48px;
right: 0;
left:0;
bottom:0;
content: '';
display: block;
height: calc(100% - 48px);
background: #707070;
border-inline: 1px solid gold;
border-bottom: 1px solid gold;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
z-index: -1;
}
}
}
}
.links {
opacity: 1;
background: none;
position: relative;
display: grid;
grid-template-columns: 1fr 1fr;
height: 100%;
width: 100px;
.editLink,
.deleteLink {
display: none;
}
>a {
opacity: .8;
&:hover {
opacity: 1;
}
}
.shareLink {
color: deepskyblue;
}
.downloadLink {
color: coral;
>span {
margin-right: 12px;
line-height: 1.5em;
}
}
}
hr {
visibility: hidden;
}
}
}
}
}
}
}
}

View File

@@ -15,18 +15,36 @@ const archive = {
.limit(limit)
.exec();
if (!brews || brews.length === 0) {
const simplifiedBrews = brews.map(brew => ({
title : brew.title,
description : brew.description,
authors : brew.authors,
invitedauthors : brew.invitedauthors,
tags : brew.tags,
pageCount : brew.pageCount,
systems : brew.systems,
renderer : brew.renderer,
thumbnail : brew.thumbnail,
createdAt : brew.createdAt,
updatedAt : brew.updatedAt,
lastViewed : brew.lastViewed,
views : brew.views,
shareId : brew.shareId,
googleId : brew.googleId
}))
if (!simplifiedBrews || simplifiedBrews.length === 0) {
// No published documents found with the given title
return res.status(404).json({ error: 'Published documents not found' });
}
let message = '';
if (brews.length === limit) {
if (simplifiedBrews.length === limit) {
// If the limit has been reached, include a message in the response
message = `You've reached the limit of ${limit} documents, you can try being more specific in your search.`;
}
return res.json({ brews, message });
return res.json({ simplifiedBrews, message });
} catch (error) {
console.error(error);
return res.status(500).json({ error: 'Internal Server Error' });