mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feature/tinder (#179)
* basic framework for match/tinder * working version of swiping * working version of profile editing * introducing backend * working matching system * working profile updating * fix all linting issues * updated events to Enum * working profile generation * documentation updates * general PR feedback * working profile loading, matches show matchedAt * slight modification to event strings * added sql imports
This commit is contained in:
46 files changed
+1932
-49
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import React from 'react';
|
||||
import { CardContent, CardMedia, Chip, Typography } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { FormattedProfile, FormattedMatch } from '../../../../../../typings/match';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {},
|
||||
tags: {
|
||||
position: 'absolute',
|
||||
bottom: '40%',
|
||||
},
|
||||
tag: {
|
||||
margin: '3px 3px 0px 0px',
|
||||
opacity: '0.8',
|
||||
},
|
||||
media: {
|
||||
height: '60%',
|
||||
},
|
||||
content: {
|
||||
height: '40%',
|
||||
overflowY: 'auto',
|
||||
},
|
||||
});
|
||||
|
||||
interface IProps {
|
||||
profile: FormattedProfile | FormattedMatch;
|
||||
}
|
||||
|
||||
const DEFAULT_IMAGE = 'https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg';
|
||||
|
||||
const Profile = ({ profile }: IProps) => {
|
||||
const c = useStyles();
|
||||
const { t } = useTranslation();
|
||||
|
||||
function parseSecondaryBio(): string | undefined {
|
||||
const { location, job } = profile;
|
||||
if (location && job) {
|
||||
return `${location} - ${job}`;
|
||||
} else if (location) {
|
||||
return location;
|
||||
} else if (job) {
|
||||
return job;
|
||||
}
|
||||
}
|
||||
|
||||
const bioSecondary = parseSecondaryBio();
|
||||
|
||||
return (
|
||||
<>
|
||||
<CardContent className={c.tags}>
|
||||
{profile.tagList.map((tag) => (
|
||||
<Chip className={c.tag} label={tag} color="primary" />
|
||||
))}
|
||||
</CardContent>
|
||||
<CardMedia className={c.media} image={profile.image || DEFAULT_IMAGE} title={profile.name} />
|
||||
<CardContent className={c.content}>
|
||||
<Typography gutterBottom variant="h4" component="h2">
|
||||
{profile.name}
|
||||
</Typography>
|
||||
<Typography gutterBottom color="textSecondary" component="p">
|
||||
{t('APPS_MATCH_PROFILE_LAST_ACTIVE', { lastActive: profile.lastActiveFormatted })}
|
||||
</Typography>
|
||||
{bioSecondary && (
|
||||
<Typography gutterBottom variant="body1" color="textSecondary" component="p">
|
||||
{bioSecondary}
|
||||
</Typography>
|
||||
)}
|
||||
<Typography variant="body2" color="textSecondary" component="p">
|
||||
{profile.bio}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Profile;
|
||||
Reference in new issue
Block a user