Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Update to imports and some minor changes done #82

Merged
merged 3 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed frontend/public/avatar.jpg
Binary file not shown.
Binary file removed frontend/public/places.jpg
Binary file not shown.
Binary file removed frontend/public/things.jpeg
Binary file not shown.
9 changes: 2 additions & 7 deletions frontend/src/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Route, Switch } from 'react-router-dom';
import { DrawerAppContent } from '@rmwc/drawer';
import Photos from '../pages/Photos';
import { Explore, People, Places, Things } from '../pages/explore';
import Upcoming from '../pages/Upcoming';
import { Photo, Photos, Search, Upcoming, Favourites } from '../pages';
import { Explore, People, Places, Things, Entity } from '../pages/explore';
import SideNav from './SideNav';
import Photo from '../pages/Photo';
import Entity from '../pages/explore/Entity';
import Search from '../pages/Search';
import Favourites from '../pages/Favourites';

const Content = (props) => {
const { open } = props;
Expand Down
14 changes: 6 additions & 8 deletions frontend/src/components/Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ const Error = () => {
<Grid>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
<GridCell desktop={4} tablet={4} phone={4}>
<img src="/warning.svg" width="100%" />
</GridCell>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
</Grid>
<Grid>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
<GridCell desktop={4} tablet={4} phone={4}>
<center>Sorry, something went wrong.</center>
<center>
<img src="/warning.svg" width="100%" />
<br />
<br />
Sorry, something went wrong.
</center>
</GridCell>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
ImageListLabel,
ImageListImageAspectContainer,
} from '@rmwc/image-list';
import { capThings } from '../utils';
import { capEntityName } from '../utils';

const PhotoImageList = (data) => {
const PeopleList = (data) => {
let history = useHistory();
const stylePeopleList = {
width: '80px',
Expand Down Expand Up @@ -46,7 +46,7 @@ const PhotoImageList = (data) => {
display: 'flex',
}}
>
{capThings(src.name)}
{capEntityName(src.name)}
</ImageListLabel>
</ImageListSupporting>
</ImageListItem>
Expand All @@ -56,4 +56,4 @@ const PhotoImageList = (data) => {
);
};

export default PhotoImageList;
export default PeopleList;
1 change: 0 additions & 1 deletion frontend/src/components/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const SideNav = (props) => {
{ id: 'Favourites', link_to: 'favourites', icon: 'star_rate' },
{ id: 'Albums', link_to: 'albums', icon: 'photo_album' },
{ id: 'Utilities', link_to: 'utilities', icon: 'filter_none' },
{ id: 'Archive', link_to: 'archive', icon: 'archive' },
{ id: 'Trash', link_to: 'trash', icon: 'delete' },
],
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/explore/ExploreEntity.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ImageListImageAspectContainer,
} from '@rmwc/image-list';
import '@rmwc/image-list/styles';
import { capThings } from '../../utils';
import { capEntityName } from '../../utils';

const ExploreEntity = ({ type, data }) => {
let history = useHistory();
Expand All @@ -32,7 +32,7 @@ const ExploreEntity = ({ type, data }) => {
/>
</ImageListImageAspectContainer>
<ImageListSupporting>
<ImageListLabel>{capThings(src.name)}</ImageListLabel>
<ImageListLabel>{capEntityName(src.name)}</ImageListLabel>
</ImageListSupporting>
</ImageListItem>
))}
Expand Down
29 changes: 20 additions & 9 deletions frontend/src/components/explore/ExploreEntityList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ import {
ImageListImageAspectContainer,
} from '@rmwc/image-list';
import '@rmwc/image-list/styles';
import { capThings } from '../../utils';
import { capEntityName } from '../../utils';

const ExploreEntityList = ({ data, type }) => {
let history = useHistory();
const stylePeopleList = {
const stylePeople = {
radius: '50%',
width: '140px',
width: '126px',
margin: '0px 6px 8px 6px',
};

const stylePlacesThigsList = {
const stylePlacesThigs = {
radius: '4px',
width: '180px',
margin: '0px 6px 8px 6px',
};

return (
<>
<ImageList withTextProtection>
<ImageList withTextProtection={type === 'people' ? false : true}>
{data.map((src) => (
<ImageListItem
key={src.id}
style={type === 'people' ? stylePeopleList : stylePlacesThigsList}
style={type === 'people' ? stylePeople : stylePlacesThigs}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylePlacesThings

>
<ImageListImageAspectContainer>
<ImageListImage
Expand All @@ -41,14 +41,25 @@ const ExploreEntityList = ({ data, type }) => {
style={{
borderRadius:
type === 'people'
? stylePeopleList.radius
: stylePlacesThigsList.radius,
? stylePeople.radius
: stylePlacesThigs.radius,
cursor: 'pointer',
}}
/>
</ImageListImageAspectContainer>
<ImageListSupporting>
<ImageListLabel>{capThings(src.name)}</ImageListLabel>
{type === 'people' ? (
<ImageListLabel
style={{
justifyContent: 'center',
display: 'flex',
}}
>
{capEntityName(src.name)}
</ImageListLabel>
) : (
<ImageListLabel>{capEntityName(src.name)}</ImageListLabel>
)}
</ImageListSupporting>
</ImageListItem>
))}
Expand Down
63 changes: 0 additions & 63 deletions frontend/src/components/explore/ExplorePeopleList.js

This file was deleted.

6 changes: 2 additions & 4 deletions frontend/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import Header from './header/Header';
import Loading from './Loading';
import Error from './Error';
import ExploreEntityList from './explore/ExploreEntityList';
import ExplorePeopleList from './explore/ExplorePeopleList';
import ExploreEntity from './explore/ExploreEntity';
import PhotoImageList from './PhotoImageList';
import PeopleList from './PeopleList';
import FavouriteAction from './FavouriteAction';

export {
Expand All @@ -16,8 +15,7 @@ export {
Loading,
Error,
ExploreEntityList,
ExplorePeopleList,
ExploreEntity,
PhotoImageList,
PeopleList,
FavouriteAction,
};
1 change: 1 addition & 0 deletions frontend/src/pages/Favourites.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const Favourites = () => {
<center>
<img src="/favourites.svg" width="100%" />
<br />
<br />
You have no favourite photos yet!
</center>
</GridCell>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/Photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
ListItemText,
} from '@rmwc/list';
import '@rmwc/list/styles';
import { capThings } from '../utils';
import { Loading, Error, PhotoImageList, FavouriteAction } from '../components';
import { capEntityName } from '../utils';
import { Loading, Error, PeopleList, FavouriteAction } from '../components';
const prettyBytes = require('pretty-bytes');

const GET_MEDIA_ITEM = gql`
Expand Down Expand Up @@ -191,7 +191,7 @@ const Photo = () => {
{people && people.length > 0 && (
<>
<div style={{ marginLeft: '60px' }}>
<PhotoImageList
<PeopleList
type="people"
data={data.mediaItem?.entities}
/>
Expand All @@ -202,7 +202,7 @@ const Photo = () => {
<ListItem>
<ListItemGraphic icon={entityTypeIcon('things')} />
<ListItemText>
{capThings(things.join(', '))}
{capEntityName(things.join(', '))}
</ListItemText>
</ListItem>
)}
Expand Down
14 changes: 6 additions & 8 deletions frontend/src/pages/Photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ const Photos = () => {
<Grid>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
<GridCell desktop={4} tablet={4} phone={4}>
<img src="/images.svg" width="100%" />
</GridCell>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
</Grid>
<Grid>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
<GridCell desktop={4} tablet={4} phone={4}>
<center>Upload your photos to iris!</center>
<center>
<img src="/images.svg" width="100%" />
<br />
<br />
Upload your photos to iris!
</center>
</GridCell>
<GridCell desktop={4} tablet={4} phone={4}></GridCell>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Search = () => {
const query = useQueryParams();
const history = useHistory();

const searchQuery = gql`
const SEARCH_QUERY = gql`
query {
search(q: "${query.get('q')}") {
totalCount
Expand All @@ -30,7 +30,7 @@ const Search = () => {
}
`;

const { error, data } = useQuery(searchQuery, { fetchPolicy: 'no-cache' });
const { error, data } = useQuery(SEARCH_QUERY, { fetchPolicy: 'no-cache' });

if (error) return <Error />;

Expand Down
12 changes: 8 additions & 4 deletions frontend/src/pages/explore/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TextField } from '@rmwc/textfield';
import { Loading, Error } from '../../components';
import { CircularProgress } from '@rmwc/circular-progress';
import { gql, useQuery, useMutation } from '@apollo/client';
import { capThings } from '../../utils';
import { capEntityName } from '../../utils';
import '@rmwc/list/styles';
import '@rmwc/textfield/styles';
import '@rmwc/circular-progress/styles';
Expand Down Expand Up @@ -86,7 +86,9 @@ const Entity = () => {
<div className="edit-section">
<TextField
defaultValue={
editEntity ? editEntity : capThings(data.entity?.name)
editEntity
? editEntity
: capEntityName(data.entity?.name)
}
onChange={(e) => setEditEntity(e.target.value)}
style={{ height: '36px' }}
Expand Down Expand Up @@ -121,7 +123,9 @@ const Entity = () => {
<>
{data.entity?.entityType === 'people' ? (
<>
{editEntity ? editEntity : capThings(data.entity.name)}
{editEntity
? editEntity
: capEntityName(data.entity.name)}
&nbsp;&nbsp;&nbsp;
<Button
icon="edit"
Expand All @@ -131,7 +135,7 @@ const Entity = () => {
/>
</>
) : (
<>{capThings(data.entity?.name)}</>
<>{capEntityName(data.entity?.name)}</>
)}
</>
)}
Expand Down
9 changes: 2 additions & 7 deletions frontend/src/pages/explore/Explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { Grid, GridCell } from '@rmwc/grid';
import { gql, useQuery } from '@apollo/client';
import {
Loading,
Error,
ExploreEntityList,
ExplorePeopleList,
} from '../../components';
import { Loading, Error, ExploreEntityList } from '../../components';
import '@rmwc/grid/styles';

const GET_PEOPLE = gql`
Expand Down Expand Up @@ -113,7 +108,7 @@ const Explore = () => {
</Grid>
<Grid>
<GridCell desktop={12} tablet={12} phone={12}>
<ExplorePeopleList
<ExploreEntityList
type="people"
data={peopleData.entities.nodes}
/>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/explore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import Explore from './Explore';
import People from './People';
import Places from './Places';
import Things from './Things';
import Entity from './Entity';

export { Explore, People, Places, Things };
export { Explore, People, Places, Things, Entity };
8 changes: 8 additions & 0 deletions frontend/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Favourites from './Favourites';
import Photo from './Photo';
import Photos from './Photos';
import Search from './Search';
import Sharing from './Sharing';
import Upcoming from './Upcoming';

export { Favourites, Photo, Photos, Search, Sharing, Upcoming };
Loading