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
@@ -1,45 +1,16 @@
|
||||
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';
|
||||
import React from 'react';
|
||||
|
||||
import UpdateButton from '../../../../ui/components/UpdateButton';
|
||||
import { useProfile } from '../../hooks/useProfile';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: 'absolute',
|
||||
bottom: '15px',
|
||||
right: '15px',
|
||||
},
|
||||
button: {
|
||||
background: '#00acee',
|
||||
},
|
||||
}));
|
||||
interface IProps {
|
||||
handleClick: () => void;
|
||||
}
|
||||
|
||||
const MINIMUM_LOAD_TIME = 750;
|
||||
|
||||
export function ProfileUpdateButton({ handleClick }) {
|
||||
const classes = useStyles();
|
||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(true);
|
||||
export function ProfileUpdateButton({ handleClick }: IProps) {
|
||||
const { updateProfileLoading } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
setMimimumLoadPassed(false);
|
||||
const timeout = window.setTimeout(() => {
|
||||
setMimimumLoadPassed(true);
|
||||
}, MINIMUM_LOAD_TIME);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [updateProfileLoading]);
|
||||
|
||||
const isLoading = updateProfileLoading || !minimumLoadPassed;
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color="primary" onClick={handleClick} disabled={isLoading}>
|
||||
<PublishIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
return <UpdateButton loading={updateProfileLoading} handleClick={handleClick} />;
|
||||
}
|
||||
|
||||
export default ProfileUpdateButton;
|
||||
@@ -5,10 +5,10 @@ import { useTranslation } from 'react-i18next';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useProfile } from '../../hooks/useProfile';
|
||||
import Avatar from '../Avatar';
|
||||
import ProfileField from './ProfileField';
|
||||
import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
|
||||
import { usePhone } from '../../../../os/phone/hooks/usePhone';
|
||||
import { TwitterEvents } from '../../../../../../typings/twitter';
|
||||
import ProfileField from '../../../../ui/components/ProfileField';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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;
|
||||
@@ -3,14 +3,14 @@ import { makeStyles } from '@material-ui/core/styles';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import ProfileField from '../../../../ui/components/ProfileField';
|
||||
import { useProfile } from '../../hooks/useProfile';
|
||||
import ProfileField from './ProfileField';
|
||||
import DefaultProfilePrompt from './DefaultProfilePrompt';
|
||||
import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { twitterState } from '../../hooks/state';
|
||||
import { usePhone } from '../../../../os/phone/hooks/usePhone';
|
||||
import { TwitterEvents } from '../../../../../../typings/twitter';
|
||||
import DefaultProfilePrompt from './DefaultProfilePrompt';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
||||
Reference in new issue
Block a user