mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-01 21:42:44 +00:00
reject modernity, embrace tradition
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
require('./archivePage.less');
|
require('./archivePage.less');
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
@@ -29,7 +30,6 @@ const ArchivePage = createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
console.log(this.state.title);
|
|
||||||
this.lookup();
|
this.lookup();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ const ArchivePage = createClass({
|
|||||||
this.setState({ searching: true, error: null });
|
this.setState({ searching: true, error: null });
|
||||||
request
|
request
|
||||||
.get(`/archive/${this.state.title}`)
|
.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 }))
|
.catch((err) => this.setState({ error: err }))
|
||||||
.finally(() => this.setState({ searching: false }));
|
.finally(() => this.setState({ searching: false }));
|
||||||
},
|
},
|
||||||
@@ -61,6 +61,7 @@ const ArchivePage = createClass({
|
|||||||
},
|
},
|
||||||
renderFoundBrews() {
|
renderFoundBrews() {
|
||||||
const brews = this.state.brewCollection;
|
const brews = this.state.brewCollection;
|
||||||
|
console.log('brews: ',brews);
|
||||||
|
|
||||||
if (!brews || brews.length === 0) {
|
if (!brews || brews.length === 0) {
|
||||||
return <div>No brews found.</div>;
|
return <div>No brews found.</div>;
|
||||||
@@ -125,6 +126,8 @@ const ArchivePage = createClass({
|
|||||||
render: function () {
|
render: function () {
|
||||||
return (
|
return (
|
||||||
<div className='archivePage'>
|
<div className='archivePage'>
|
||||||
|
<link href='/themes/V3/Blank/style.css' rel='stylesheet'/>
|
||||||
|
<link href='/themes/V3/5ePHB/style.css' rel='stylesheet'/>
|
||||||
{this.renderNavItems()}
|
{this.renderNavItems()}
|
||||||
|
|
||||||
<div className='content'>
|
<div className='content'>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ body {
|
|||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
color: white;
|
color: white;
|
||||||
filter: drop-shadow(0 0 5px black);
|
filter:drop-shadow(0 0 5px black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,9 +66,11 @@ body {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-left: 2px solid;
|
border-left: 2px solid;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
font-family: "BookInsanityRemake";
|
||||||
|
font-size: .34cm;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
height: 100px;
|
height: 10vh;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
@@ -79,186 +81,58 @@ body {
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.foundBrews {
|
.foundBrews {
|
||||||
position:relative;
|
position: relative;
|
||||||
background-color: #2C3E50;
|
background-color: #2C3E50;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 500px;
|
max-height: 100%;
|
||||||
height: 100%;
|
height: 66.7vh;
|
||||||
padding: 50px;
|
padding: 50px;
|
||||||
padding-bottom: unset;
|
overflow-y:scroll;
|
||||||
|
|
||||||
.limit {
|
.limit {
|
||||||
position:fixed;
|
position: fixed;
|
||||||
bottom:0;
|
bottom: 0;
|
||||||
left:502px;
|
left: 502px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color:white;
|
color: white;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
|
|
||||||
&:has(p:empty) {
|
&:has(p:empty) {
|
||||||
display:none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.brewItem {
|
.brewItem {
|
||||||
height: 50px;
|
background-image: url('/assets/parchmentBackground.jpg');
|
||||||
min-height: unset;
|
width: 48%;
|
||||||
width: 100%;
|
margin-right: 40px;
|
||||||
display: flex;
|
&:nth-child(2n+1) {
|
||||||
color: white;
|
margin-right: 0;
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
h2 {
|
||||||
hr {
|
font-size: 0.75cm;
|
||||||
display: none;
|
line-height: 0.988em;
|
||||||
|
font-family: "MrEavesRemake";
|
||||||
|
font-weight: 800;
|
||||||
|
color: var(--HB_Color_HeaderText);
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
width: 100%;
|
font-family: ScalySansRemake;
|
||||||
display: grid;
|
font-size: 1.2em;
|
||||||
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"] {
|
>span {
|
||||||
display:inline-block;
|
margin-right: 12px;
|
||||||
grid-area: storage;
|
line-height: 1.5em;
|
||||||
filter:drop-shadow(0 0 10px white);
|
|
||||||
}
|
|
||||||
|
|
||||||
.brewTags {
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,18 +15,36 @@ const archive = {
|
|||||||
.limit(limit)
|
.limit(limit)
|
||||||
.exec();
|
.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
|
// No published documents found with the given title
|
||||||
return res.status(404).json({ error: 'Published documents not found' });
|
return res.status(404).json({ error: 'Published documents not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
let message = '';
|
let message = '';
|
||||||
if (brews.length === limit) {
|
if (simplifiedBrews.length === limit) {
|
||||||
// If the limit has been reached, include a message in the response
|
// 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.`;
|
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) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).json({ error: 'Internal Server Error' });
|
return res.status(500).json({ error: 'Internal Server Error' });
|
||||||
|
|||||||
Reference in New Issue
Block a user