Skip to content

Commit

Permalink
Rename tools to resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis committed Aug 30, 2023
1 parent c31a26b commit 75576fa
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 70 deletions.
4 changes: 2 additions & 2 deletions src/component/InsideApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PageHome from "./PageHome.jsx";
import PageEcosystem from "./PageEcosystem.jsx";
import PageNews from "./PageNews.jsx";
import PageJobs from "./PageJobs.jsx";
import PageTools from "./PageTools.jsx";
import PageResources from "./PageResources.jsx";
import PageServices from "./PageServices.jsx";
import PageService from "./PageService.jsx";
/* import PageEvents from "./PageEvents.jsx"; */
Expand Down Expand Up @@ -106,7 +106,7 @@ export default class InsideApp extends React.Component {
<Route path="/jobs" render={(props) => <PageJobs
{...props}
/>}/>
<Route path="/tools" render={(props) => <PageTools
<Route path="/resources" render={(props) => <PageResources
analytics={this.state.analytics}
{...props}
/>}/>
Expand Down
File renamed without changes.
63 changes: 21 additions & 42 deletions src/component/PageTools.jsx → src/component/PageResources.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import React from "react";
import "./PageTools.css";
import "./PageResources.css";
import Breadcrumb from "react-bootstrap/Breadcrumb";
import { Link } from "react-router-dom";
import { NotificationManager as nm } from "react-notifications";
import { getRequest } from "../utils/request.jsx";
import Loading from "./box/Loading.jsx";
import Message from "./box/Message.jsx";
import ToolHorizontal from "./item/ToolHorizontal.jsx";
import ResourceHorizontal from "./item/ResourceHorizontal.jsx";
import SimpleTable from "./table/SimpleTable.jsx";
import ServiceSearch from "./form/ServiceSearch.jsx";
import { getUrlParameter, dictToURI } from "../utils/url.jsx";
import { getSettingValue } from "../utils/setting.jsx";

export default class PageTools extends React.Component {
export default class PageResources extends React.Component {
constructor(props) {
super(props);

this.state = {
tools: null,
taxonomy: "TOOL CATEGORY",
resources: null,
taxonomy: "RESOURCE CATEGORY",
filters: {
title: getUrlParameter("title"),
type: "RESOURCE",
include_tags: true,
},
};
}
Expand All @@ -37,7 +39,7 @@ export default class PageTools extends React.Component {

getRequest.call(this, "public/get_public_articles?" + dictToURI(params), (data) => {
this.setState({
tools: data,
resources: data,
});
}, (response) => {
nm.warning(response.statusText);
Expand All @@ -53,29 +55,6 @@ export default class PageTools extends React.Component {
this.getTools();
}

getTaxonomyValueId(value) {
if (this.props.analytics) {
const v = this.props.analytics.taxonomy_values
.filter((va) => va.category === this.state.taxonomy && va.name === value);

if (v.length > 0) {
return v[0].id;
}
}

return null;
}

getArticleIdsFromTaxonomyValue(value) {
if (!this.props.analytics) {
return [];
}

return this.props.analytics.taxonomy_assignments
.filter((a) => a.taxonomy_value_id === this.getTaxonomyValueId(value))
.map((a) => a.article_id);
}

modifyFilters(field, value) {
const filters = { ...this.state.filters };
filters[field] = value;
Expand All @@ -84,7 +63,7 @@ export default class PageTools extends React.Component {

render() {
return (
<div className={"PageTools page max-sized-page"}>
<div className={"PageResources page max-sized-page"}>
<div className="row">
<div className="col-md-12">
<Breadcrumb>
Expand All @@ -93,7 +72,7 @@ export default class PageTools extends React.Component {
<Link to="/">{getSettingValue(this.props.settings, "PROJECT_NAME")}</Link>
</Breadcrumb.Item>
}
<Breadcrumb.Item><Link to="/ecosystem">Ecosystem</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to="/resources">Resources</Link></Breadcrumb.Item>
</Breadcrumb>
</div>
</div>
Expand All @@ -113,19 +92,19 @@ export default class PageTools extends React.Component {
<h1>{v.name}</h1>
</div>

{this.state.tools
&& this.state.tools.items
.filter((c) => this.getArticleIdsFromTaxonomyValue(v).indexOf(c.id) >= 0)
{this.state.resources
&& this.state.resources.items
.filter((c) => c.taxonomy_tags.indexOf(v.id) >= 0)
.length > 0
&& <div className="col-md-12">
<SimpleTable
numberDisplayed={10}
elements={this.state.tools.items
.filter((c) => this.getArticleIdsFromTaxonomyValue(v).indexOf(c.id) >= 0)
elements={this.state.resources.items
.filter((c) => c.taxonomy_tags.indexOf(v.id) >= 0)
.map((a, i) => [a, i])}
buildElement={(a) => (
<div className="col-md-6">
<ToolHorizontal
<ResourceHorizontal
info={a}
/>
</div>
Expand All @@ -134,19 +113,19 @@ export default class PageTools extends React.Component {
</div>
}

{this.state.tools
&& this.state.tools.items
.filter((c) => this.getArticleIdsFromTaxonomyValue(v).indexOf(c.id) >= 0)
{this.state.resources
&& this.state.resources.items
.filter((c) => c.taxonomy_tags.indexOf(v.id) >= 0)
.length === 0
&& <div className="col-md-12">
<Message
text={"No tool found"}
text={"No resource found"}
height={200}
/>
</div>
}

{!this.state.tools
{!this.state.resources
&& <div className="col-md-12">
<Loading
height={200}
Expand Down
2 changes: 1 addition & 1 deletion src/component/bar/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Footer extends React.Component {
<Link to="/services">Services</Link>
</div>
<div>
<Link to="/tools">Tools</Link>
<Link to="/resources">Resources</Link>
</div>
<br/>
<div>
Expand Down
6 changes: 3 additions & 3 deletions src/component/bar/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default class Menu extends React.Component {
</Link>
</Nav.Link>
<Nav.Link>
<Link to="/tools">
<div className="Menu-title">Tools</div>
<div className="Menu-description">Get well equipped</div>
<Link to="/resources">
<div className="Menu-title">Resources</div>
<div className="Menu-description">Get well prepared</div>
</Link>
</Nav.Link>
</Nav>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@

.ToolHorizontal {
.ResourceHorizontal {
margin: 5px 0px !important;
overflow: hidden;
line-height: 1 !important;
}

.ToolHorizontal-link {
.ResourceHorizontal-link {
color: inherit;
}

.ToolHorizontal-link:hover {
.ResourceHorizontal-link:hover {
color: initial !important;
text-decoration: none;
}

.ToolHorizontal:hover {
.ResourceHorizontal:hover {
background-color: #e7f5f4;
}

@media (min-width: 500px) {
.ToolHorizontal .card-horizontal {
.ResourceHorizontal .card-horizontal {
height: 100%;
display: flex;
flex: 1 1 auto;
}
}

@media (min-width: 0px) {
.ToolHorizontal .img-square-wrapper {
.ResourceHorizontal .img-square-wrapper {
width: 100%;
height: 130px;
}
}

@media (min-width: 500px) {
.ToolHorizontal .img-square-wrapper {
.ResourceHorizontal .img-square-wrapper {
object-fit: cover;
display: flex;
margin: auto;
Expand All @@ -43,14 +43,14 @@
}
}

.ToolHorizontal .img-square-wrapper img {
.ResourceHorizontal .img-square-wrapper img {
object-fit: cover;
width: 100%;
height: 100%;
border-radius: unset !important;
}

.ToolHorizontal .card-date {
.ResourceHorizontal .card-date {
position: absolute;
background: #109E92;
text-align: center;
Expand All @@ -61,26 +61,26 @@
text-transform: uppercase;
}

.ToolHorizontal .card-body {
.ResourceHorizontal .card-body {
padding: .9rem 1rem !important;
}

@media (min-width: 0px) {
.ToolHorizontal .card-body button {
.ResourceHorizontal .card-body button {
display: none;
}
}

@media (min-width: 500px) {
.ToolHorizontal .card-body button {
.ResourceHorizontal .card-body button {
display: block;
position: absolute;
bottom: 10px;
right: 15px;
}
}

.ToolHorizontal .card-body h5 {
.ResourceHorizontal .card-body h5 {
font-weight: bold !important;
margin-bottom: 5px !important;
max-width: 100%;
Expand All @@ -92,27 +92,27 @@
}

@media (min-width: 0px) {
.ToolHorizontal .card-body button {
.ResourceHorizontal .card-body button {
display: none;
}
}

@media (min-width: 500px) {
.ToolHorizontal .card-body button {
.ResourceHorizontal .card-body button {
display: block;
position: absolute;
bottom: 10px;
right: 15px;
}
}

.ToolHorizontal .card-tags {
.ResourceHorizontal .card-tags {
height: 30px;
overflow: hidden;
text-overflow: ellipsis;
}

.ToolHorizontal .card-text {
.ResourceHorizontal .card-text {
padding: 5px 1rem 55px 1rem;
text-align: justify;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Component } from "react";
import "./ToolHorizontal.css";
import "./ResourceHorizontal.css";
import dompurify from "dompurify";
import { Link } from "react-router-dom";
import NoImage from "../box/NoImage.jsx";
import { getApiURL } from "../../utils/env.jsx";

export default class ToolHorizontal extends Component {
export default class ResourceHorizontal extends Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -38,7 +38,7 @@ export default class ToolHorizontal extends Component {

getBoxContent() {
return (
<div className="ToolHorizontal card">
<div className="ResourceHorizontal card">
<div className="card-horizontal">
<div className="img-square-wrapper">
{this.getImage()
Expand Down Expand Up @@ -83,10 +83,10 @@ export default class ToolHorizontal extends Component {
href={this.props.info.link}
target={"_blank"}
rel="noreferrer"
className="ToolHorizontal-link">
className="ResourceHorizontal-link">
{this.getBoxContent()}
</a>
: <Link to={"/tool/" + this.props.info.handle} className="ToolHorizontal-link">
: <Link to={"/tool/" + this.props.info.handle} className="ResourceHorizontal-link">
{this.getBoxContent()}
</Link>;
}
Expand Down

0 comments on commit 75576fa

Please sign in to comment.