From da699e999f6513c65b0e63fd8d5ee765fd004e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 22 Jan 2024 23:20:36 +0100 Subject: [PATCH] basic looks --- client/homebrew/homebrew.jsx | 2 + .../pages/archivePage/archivePage.jsx | 133 ++++++++++++++++++ .../pages/archivePage/archivePage.less | 74 ++++++++++ 3 files changed, 209 insertions(+) create mode 100644 client/homebrew/pages/archivePage/archivePage.jsx create mode 100644 client/homebrew/pages/archivePage/archivePage.less diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index a08a39ea0..257128766 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -11,6 +11,7 @@ const SharePage = require('./pages/sharePage/sharePage.jsx'); const NewPage = require('./pages/newPage/newPage.jsx'); const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); +const ArchivePage = require('./pages/archivePage/archivePage.jsx'); const AccountPage = require('./pages/accountPage/accountPage.jsx'); const WithRoute = (props)=>{ @@ -74,6 +75,7 @@ const Homebrew = createClass({ } /> } /> } /> + }/> } /> } /> } /> diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx new file mode 100644 index 000000000..29243eeb9 --- /dev/null +++ b/client/homebrew/pages/archivePage/archivePage.jsx @@ -0,0 +1,133 @@ +require('./archivePage.less'); +const React = require('react'); +const createClass = require('create-react-class'); +const _ = require('lodash'); +const cx = require('classnames'); +const moment = require('moment'); + +const Nav = require('naturalcrit/nav/nav.jsx'); +const Navbar = require('../../navbar/navbar.jsx'); + +const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; +const Account = require('../../navbar/account.navitem.jsx'); +const NewBrew = require('../../navbar/newbrew.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); + +const NaturalCritIcon = require('naturalcrit/svg/naturalcrit.svg.jsx'); + +const ArchivePage = createClass({ + displayName : 'ArchivePage', + getDefaultProps : function() { + return { + query : '', + foundBrew : null, + searching : false, + error : null + }; + }, + getInitialState : function() { + return { + uiItems : this.props.uiItems + }; + }, + handleChange(e){ + this.setState({ query: e.target.value }); + }, + lookup(){ + this.setState({ searching: true, error: null }); + + request.get(`/admin/lookup/${this.state.query}`) + .then((res)=>this.setState({ foundBrew: res.body })) + .catch((err)=>this.setState({ error: err })) + .finally(()=>this.setState({ searching: false })); + }, + renderFoundBrew(){ + const brew = this.state.foundBrew; + return
+
+
Title
+
{brew.title}
+ +
Authors
+
{brew.authors.join(', ')}
+ +
Edit Link
+
/edit/{brew.editId}
+ +
Share Link
+
/share/{brew.shareId}
+ +
Last Updated
+
{Moment(brew.updatedAt).fromNow()}
+ +
Num of Views
+
{brew.views}
+
+
; + }, + + renderForm: function() { + return
+

Brew Lookup

+ + {/* In the future, we should be able to filter the results by adding tags. + + */} + + + {this.state.error + &&
{this.state.error.toString()}
+ } + + {this.state.foundBrew + ? this.renderFoundBrew() + :
No brew found.
+ } +
; + }, + + renderResults : function() { + + }, + + renderNavItems : function() { + return + + + + + + + ; + }, + + render : function() { + return
+ {this.renderNavItems()} + +
+
+

Welcome to the Archive

+
+
+
+ {this.renderForm()} +
+
+
+

Your results, my lordship

+ {this.renderResults()} +
+
+
+
+
+ } +}); + +module.exports = ArchivePage; \ No newline at end of file diff --git a/client/homebrew/pages/archivePage/archivePage.less b/client/homebrew/pages/archivePage/archivePage.less new file mode 100644 index 000000000..50ddf4de1 --- /dev/null +++ b/client/homebrew/pages/archivePage/archivePage.less @@ -0,0 +1,74 @@ + + +.archivePage { + height:100%; + background-color: #2C3E50; + .content { + display:grid; + grid-template-rows: 20vh 1fr; + + .welcome { + background: url('https://i.imgur.com/MJ4YHu7.jpg'); + background-size:100%; + background-position:center; + height:20vh; + + h1 { + font-size:40px; + font-weight:900; + color:white; + filter: drop-shadow(0 0 5px black); + } + } + + .flexGroup { + height:100%; + display:grid; + grid-template-columns:1fr 2fr; + + .dataGroup { + width:100%; + height:100%; + background:white; + + &.form .brewLookup { + padding:100px; + + h2 { + font-size:20px; + font-weight: 900; + border-bottom:2px solid; + margin-block: 20px; + } + + label { + margin-right:10px; + } + input+button { + margin-left:20px; + } + } + + &.resultsContainer { + display:flex; + flex-direction: column; + border-left:2px solid; + height:76.8vh; + + .title { + height:20%; + background-color: #333; + display:grid; + place-items: center; + + h2 { + font-size:20px; + color:white; + font-weight:900; + } + } + } + } + } + } +} \ No newline at end of file