Skip to content

Commit

Permalink
Hotfix/all/thumhnail url (#215)
Browse files Browse the repository at this point in the history
Hotfix/all/thumhnail url
  • Loading branch information
Junow authored Dec 22, 2019
2 parents 4d686f5 + 836fcc6 commit 1ed2e38
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
5 changes: 4 additions & 1 deletion client/src/components/MusicDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IMusicContent } from '../MusicDetail/types';
import { IMusic } from '../UploadMusic/types';
import { getShortId, getTimeSimple } from '../../utils';
import Comment from '../Comment';
import { CircularProgress } from '@material-ui/core';

const MusicDetail: React.FC<MusicDetailProp> = ({
data,
Expand Down Expand Up @@ -62,7 +63,9 @@ const MusicDetail: React.FC<MusicDetailProp> = ({

return (
isLoading || data === null
? (<div>Loading...</div>)
? (<S.Progress>
<CircularProgress color="inherit" />
</S.Progress>)
: (
<S.Container>
<S.Header>
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/MusicDetail/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ export const CopyRight = styled.div`
margin: 5rem 0;
color: ${theme.AMERICAN_RIVER};
`;

export const Progress = styled.div`
margin: auto auto;
margin-top: 20px;
color: ${theme.BORDER_GRAY};
`;
7 changes: 4 additions & 3 deletions client/src/components/Portfolio/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { useSelector } from 'react-redux';
import * as S from './style';
import StyledLink from '../../basics/StyledLink';
Expand Down Expand Up @@ -30,7 +30,7 @@ const Portfolio:React.FC<portfolioProp> = ({
const showFollowersPopup = () => { setShowFollowers(true); };
const closeFollowingsPopup = () => { setShowFollowings(false); };
const showFollowingsPopup = () => { setShowFollowings(true); };
const thumbnailUrl = useSelector((state:RootState) => state.login.thumbnailUrl);
const thumbnailUrl = useRef('');

const onClickFollow = () => {
if (followable) {
Expand Down Expand Up @@ -67,6 +67,7 @@ const Portfolio:React.FC<portfolioProp> = ({
} else {
setFollowable(true);
}
thumbnailUrl.current = data.thumbnailUrl;
}
});
}
Expand All @@ -88,7 +89,7 @@ const Portfolio:React.FC<portfolioProp> = ({
</S.FollowLine>

</S.PortfolioDetail>
<S.PortfolioImage src={thumbnailUrl} />
<S.PortfolioImage src={thumbnailUrl.current} />
</S.PortfolioBox>
<S.IntroduceBox>
{isLogin
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/WorksDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { WorksDetailProp } from './types';
import { UPLOAD } from '../../utils/constants';
import { RootState } from '../../modules';
import { CircularProgress } from '@material-ui/core';

const WorksDetail:React.FC<WorksDetailProp> = ({
data, inputComment, user, isLoading, isError, changeInputHandler, addNewComment,
Expand Down Expand Up @@ -69,7 +70,11 @@ const WorksDetail:React.FC<WorksDetailProp> = ({

return (
isLoading || data === null
? (<div>Loading...</div>)
? (
<S.Progress>
<CircularProgress color="inherit" />
</S.Progress>
)
: (
<S.Container>
<S.Title>{data.title}</S.Title>
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/WorksDetail/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@ export const ImageContent = styled.div<ImageContentProp>`
background-position: center center;
margin-top: 1rem;
`;

export const Progress = styled.div`
margin: auto auto;
margin-top: 20px;
color: ${theme.BORDER_GRAY};
`;
1 change: 0 additions & 1 deletion client/src/containers/CreatorContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import styled from 'styled-components';
import { useSelector } from 'react-redux';
import { API_SERVER } from '../utils/constants';
import { theme } from '../style/theme';
// import FeedMyWorks from '../components/FeedMyWorks';
import Portfolio from '../components/Portfolio';
import FeedMyWorkContainer from './FeedMyWorkContainer';
import { RootState } from '../modules';
Expand Down
9 changes: 6 additions & 3 deletions server/services/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const get10Images = (skip, limit) => Image.find()
.skip(skip)
.limit(limit)
.populate('creator', 'name thumbnailUrl')
.populate('owner', 'emoji comments views title');
.populate('owner', 'emoji comments views title')
.sort({ updatedAt: -1 });

const getIdsImages = (id) => Image.find({ creator: id })
.populate('creator', 'name thumbnailUrl')
Expand All @@ -19,7 +20,8 @@ const get10Wallpapers = (skip, limit) => Wallpaper.find()
.skip(skip)
.limit(limit)
.populate('creator', 'name thumbnailUrl')
.populate('owner', 'emoji comments views title');
.populate('owner', 'emoji comments views title')
.sort({ updatedAt: -1 });

const getImageFeeds = (skip, limit) => Image.find()
.skip(skip)
Expand All @@ -31,7 +33,8 @@ const get10Musics = (skip, limit) => Music.find()
.skip(skip)
.limit(limit)
.populate('creator', 'name thumbnailUrl')
.populate('owner', 'comments views');
.populate('owner', 'comments views')
.sort({ updatedAt: -1 });

const getIdsMusics = (id) => Music.find({ creator: id })
.populate('creator', 'name thumbnailUrl')
Expand Down

0 comments on commit 1ed2e38

Please sign in to comment.