mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +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,40 @@
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { TextField } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
formContainer: {
|
||||
width: '100%',
|
||||
marginTop: '8px',
|
||||
},
|
||||
textField: {
|
||||
width: '100%',
|
||||
},
|
||||
});
|
||||
|
||||
function ProfileField({ label, value, handleChange, allowChange, multiline, inputRef }) {
|
||||
const classes = useStyles();
|
||||
const _handleChange = (e) => handleChange(e.target.value);
|
||||
|
||||
return (
|
||||
<div className={classes.formContainer}>
|
||||
<TextField
|
||||
className={classes.textField}
|
||||
label={label}
|
||||
value={value}
|
||||
onChange={_handleChange}
|
||||
disabled={!allowChange}
|
||||
multiline={multiline}
|
||||
inputRef={inputRef}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
ProfileField.defaultProps = {
|
||||
allowChange: true,
|
||||
multiline: false,
|
||||
inputRef: null,
|
||||
};
|
||||
|
||||
export default ProfileField;
|
||||
@@ -0,0 +1,44 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Fab } from '@material-ui/core';
|
||||
import PublishIcon from '@material-ui/icons/Publish';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
position: 'absolute',
|
||||
bottom: '15px',
|
||||
right: '15px',
|
||||
},
|
||||
});
|
||||
|
||||
const MINIMUM_LOAD_TIME = 750;
|
||||
|
||||
interface IProps {
|
||||
handleClick: () => void;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export function ProfileUpdateButton({ handleClick, loading }: IProps) {
|
||||
const classes = useStyles();
|
||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
setMimimumLoadPassed(false);
|
||||
const timeout = window.setTimeout(() => {
|
||||
setMimimumLoadPassed(true);
|
||||
}, MINIMUM_LOAD_TIME);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [loading]);
|
||||
|
||||
const isLoading = loading || !minimumLoadPassed;
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab color="primary" onClick={handleClick} disabled={isLoading}>
|
||||
<PublishIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfileUpdateButton;
|
||||
Reference in new issue
Block a user