Skip to content

Commit

Permalink
map tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaanahmed committed Sep 14, 2023
1 parent b92e7df commit 01e01be
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 302 deletions.
1 change: 1 addition & 0 deletions backend/app/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from django.db.models import Q, Prefetch
from django.core.paginator import Paginator
from django.views.decorators.csrf import csrf_exempt

from app.view_helpers import (
get_map_squares_by_arondissement,
Expand Down
3 changes: 1 addition & 2 deletions backend/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ class Meta:
fields = [
'id', 'number', 'folder', 'map_square_number',
'alt', 'photographer_name', 'photographer_number',
'shelfmark', 'librarian_caption', 'photographer_caption',
'contains_sticker', 'analyses', 'map_square_coords', 'slide_url', 'photo_url',
'analyses', 'map_square_coords', 'slide_url', 'photo_url',
'photo_page_url'
]

Expand Down
10 changes: 2 additions & 8 deletions frontend/components/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class Legend extends React.Component {
render() {
return (
<div className="legend">
<h6 className="text-uppercase">Legend</h6>
<ul>
{this.props.layers.map(layer => {
return <li key={layer}>
Expand All @@ -20,16 +19,11 @@ export class Legend extends React.Component {
className={`legend-square
${layer.toLowerCase()}
${this.props.visibleLayers.indexOf(layer) > -1 ? "" : "inactive"}`}/>


<span className={"label"}>{layer}</span>
</li>;

})}
</ul>
<div className="photos-available-subtext">
(from least to most)
</div>
</ul>
</div>
);
}
Expand Down
6 changes: 1 addition & 5 deletions frontend/components/TitleDecoratorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export class TitleDecoratorContainer extends React.Component {
const headerStyle = {
background: `url(${TitleDecoratorURL})`,
backgroundRepeat: `no-repeat`,
width: 221,
height: 55,
marginLeft: 35,
marginBottom: 30,
paddingTop: 22,
paddingLeft: 20

Expand All @@ -34,7 +30,7 @@ export class TitleDecoratorContainer extends React.Component {
decorator_type={"title-decorator"}/> */}

{/* <img src={} /> */}
<h2 style={headerStyle}> {this.props.title}</h2>
<h2 style={headerStyle}>{this.props.title}</h2>
</Col>
</Row>
</Container>
Expand Down
63 changes: 2 additions & 61 deletions frontend/components/map-page/MapSquareContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,18 @@ import React from "react";
import * as PropTypes from "prop-types";
import {PhotoViewer} from "../../components/PhotoViewer";
import {Row, Col} from "react-bootstrap";
import Loading from "../Loading";

export class MapSquareContent extends PhotoViewer {
constructor(props) {
super(props);
}

getPhotographersGrid(
photographerData,
config = {
className: "",
titleFunc: (_key, photographer) =>
`Map Square: ${photographer["map_square"]}, Photographer: ${photographer["name"]}`,
hrefFunc: (_key, photographer) => `/photographer/${photographer["number"]}/`,
onClickFunc: (_key, _photographer) => (_e) => {},
}
) {
const {className, titleFunc, hrefFunc, onClickFunc} = config;

return photographerData.map((photographer, key) => {
return (
<li
className={`default-photographer list-inline-item ${className}`}
key={key}
onClick={(e) => {
onClickFunc(key, photographer)(e);
window.open(hrefFunc(key, photographer), "_self");
}}
>
<button
type="button"
className="btn-secondary-blue"
title={titleFunc(key, photographer)}
href={hrefFunc(key, photographer)}
onClick={onClickFunc(key, photographer)}
>
{photographer["name"]}
</button>
</li>
);
});
}

render() {
return (
<>
{this.props.photos.length ? (
<>
<h6 className={"text-uppercase"}>Example photos</h6>
<Row>
<Col className={"p-0"}>
<div className="formatting-photos">
Expand All @@ -64,31 +28,8 @@ export class MapSquareContent extends PhotoViewer {
</Row>
</>
) : (
<></>
)}
{this.props.photographers.length ? (
<>
<h6 className={"text-uppercase"}>Photographers</h6>
<Row>
<Col className={"p-1"}>
<ul className={"list-inline p-0"}>
{this.getPhotographersGrid(this.props.photographers)}
</ul>
</Col>
</Row>
</>
) : (
<></>
<Loading />
)}
{
<Row>
<Col className="d-inline-block p-0">
<a className={"link"} href={"/map_square/" + this.props.mapSquare}>
Go to map square
</a>
</Col>
</Row>
}
</>
);
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/pages/Explore.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';

import { getCookie } from '../common';
import SearchBgTopLeft from "../images/search_top_left.svg?url";
import SearchBgTopRight from "../images/search_top_right.svg?url";
import Loading from '../components/Loading';
Expand Down Expand Up @@ -49,7 +49,8 @@ export class Explore extends React.Component {
const response = await fetch('/api/explore/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'X-CSRFToken': getCookie('csrftoken')
},
body: JSON.stringify({
selectedTag: this.state.selectedTag,
Expand Down
Loading

0 comments on commit 01e01be

Please sign in to comment.