Skip to content

Commit

Permalink
Merge pull request #4 from saad696/bug-fixes
Browse files Browse the repository at this point in the history
bug fixes
  • Loading branch information
saad696 authored Dec 17, 2021
2 parents 43df90a + a2ebc7d commit 5895966
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 217 deletions.
8 changes: 1 addition & 7 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
"react/no-unescaped-entities": "off"
}
}
366 changes: 242 additions & 124 deletions client/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"@emotion/react": "^11.7.0",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.2.0",
"@mui/lab": "^5.0.0-alpha.60",
"@mui/material": "^5.2.1",
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.24.0",
"dotenv": "^10.0.0",
"eslint": "^7.11.0",
"firebase": "^9.5.0",
"history": "^5.1.0",
"moment": "^2.29.1",
Expand Down Expand Up @@ -58,7 +60,6 @@
},
"devDependencies": {
"autoprefixer": "^9.8.8",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
Expand Down
50 changes: 48 additions & 2 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,29 @@ body {
.str-chat-channel-list {
height: fit-content;
margin-bottom: 8px;
overflow-y: auto;
}

.str-chat-channel-list::-webkit-scrollbar {
width: 5px;
height: 5px;
}

.str-chat-channel-list::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
-webkit-border-radius: 10px;
border-radius: 10px;
}

.str-chat-channel-list::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.3);
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}

.str-chat-channel-list::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255, 255, 255, 0.3);
}

.str-chat-channel {
Expand Down Expand Up @@ -975,6 +998,27 @@ body {
flex-direction: column;
}

@media screen and (max-width: 768px) {
.team-channel-list {
height: 650px;
overflow-y: auto;
}

@media screen and (min-height: 651px) and (max-height: 850px) {
.team-channel-list {
height: 550px;
overflow-y: auto;
}
}

@media screen and (min-height: 100px) and (max-height: 650px) {
.team-channel-list {
height: 400px;
overflow-y: auto;
}
}
}

.team-channel-list__message {
color: #ffffff;
padding: 0 16px;
Expand Down Expand Up @@ -1980,6 +2024,7 @@ div.rta__autocomplete.str-chat__emojisearch {

.channel-list__list__wrapper {
width: 100%;
overflow: hidden !important;
}

.channerl-list__container-toggle {
Expand Down Expand Up @@ -2047,7 +2092,8 @@ div.rta__autocomplete.str-chat__emojisearch {
.str-chat-channel-list.commerce {
position: relative !important;
left: 0 !important;
min-height: 0 !important;
height: 100vh;
overflow-y: auto;
}
}

Expand All @@ -2060,6 +2106,6 @@ div.rta__autocomplete.str-chat__emojisearch {
padding: 0 !important;
}

.my-profile__container{
.my-profile__container {
background-color: #20235a;
}
123 changes: 66 additions & 57 deletions client/src/components/Auth.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React, { useState } from 'react';
import Cookies from 'universal-cookie';
import axios from 'axios';
import {
getAuth,
RecaptchaVerifier,
signInWithPhoneNumber,
} from 'firebase/auth';
import { NotificationPopup, ThemeSwitch } from '.';
import {
TextField,
Expand All @@ -19,9 +14,12 @@ import {
Button,
} from '@mui/material';

import LoadingButton from '@mui/lab/LoadingButton';

import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
import useWindowDimensions from '../hooks/use-window-dimensions';
import { auth, RecaptchaVerifierFirebase, signInWithPno } from '../firebase';

const cookies = new Cookies();

Expand All @@ -41,6 +39,7 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
const [msg, setMsg] = useState(0);
const [OTPsend, setOTPsend] = useState(false);
const [validationErr, setValidationErr] = useState(0);
const [loading, setLoading] = useState(false);

// eslint-disable-next-line no-unused-vars
const { width, height } = useWindowDimensions();
Expand All @@ -57,8 +56,7 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
};

const configureCaptcha = () => {
const auth = getAuth();
window.recaptchaVerifier = new RecaptchaVerifier(
window.recaptchaVerifier = new RecaptchaVerifierFirebase(
'sign-in-button',
{
size: 'invisible',
Expand All @@ -75,6 +73,7 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {

const handleSubmit = async (e) => {
e?.preventDefault();
setLoading(true);
if (isSignup && form.password !== form.confirmPassword) {
setValidationErr(4);
} else if (isSignup && form.phoneNumber.length > 10) {
Expand All @@ -87,9 +86,7 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {

const _phoneNumber = `+91${phoneNumber}`;
const appVerifier = window.recaptchaVerifier;

const auth = getAuth();
signInWithPhoneNumber(auth, _phoneNumber, appVerifier)
signInWithPno(auth, _phoneNumber, appVerifier)
.then((confirmationResult) => {
// SMS sent. Prompt user to type the code from the message, then sign the
// user in with confirmationResult.confirm(code).
Expand All @@ -102,6 +99,7 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
.catch(() => {
setMsg(2);
setOTPsend(false);
setLoading(false);
});
} else {
// for login
Expand Down Expand Up @@ -130,13 +128,16 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
window.location.reload();
} catch (error) {
setMsg(4);
setLoading(false);
}
}
}
setLoading(false);
};

const onVerifyOTP = (e) => {
e?.preventDefault();
setLoading(true);
const code = form.otp;
window.confirmationResult
.confirm(code)
Expand Down Expand Up @@ -170,7 +171,9 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
})
.catch(() => {
setMsg(3);
setLoading(false);
});
setLoading(false);
};

const swicthMode = () => {
Expand Down Expand Up @@ -235,34 +238,36 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
</div>
<div className="auth__form-container_fields-content dark:bg-gray-700 shadow-lg">
<p className="dark:text-gray-300">
<div className="flex justify-between">
<Button
onClick={() => {
setIsSignup(true);
setForm(initialState);
}}
variant="text"
size="large"
fullWidth
>
<span className="font-bold">
Sign Up
</span>
</Button>
<Button
onClick={() => {
setIsSignup(false);
setForm(initialState);
}}
variant="text"
size="large"
fullWidth
>
<span className="font-bold">
Sign In
</span>
</Button>
</div>
{!OTPsend && (
<div className="flex justify-between">
<Button
onClick={() => {
setIsSignup(true);
setForm(initialState);
}}
variant="text"
size="large"
fullWidth
>
<span className="font-bold">
Sign Up
</span>
</Button>
<Button
onClick={() => {
setIsSignup(false);
setForm(initialState);
}}
variant="text"
size="large"
fullWidth
>
<span className="font-bold">
Sign In
</span>
</Button>
</div>
)}
{!OTPsend && (
<form onSubmit={handleSubmit}>
<div id="sign-in-button"></div>
Expand Down Expand Up @@ -488,7 +493,8 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
</Grid>
</div>

<Button
<LoadingButton
loading={loading}
type="submit"
variant={
mode === 'dark'
Expand All @@ -499,10 +505,10 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
{isSignup
? 'Sign Up'
: 'Sign In'}
</Button>
</LoadingButton>
</form>
)}
{OTPsend && (
{OTPsend && isSignup && (
<form
onSubmit={onVerifyOTP}
className="mt-3"
Expand All @@ -519,7 +525,8 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
required
/>
</Grid>
<Button
<LoadingButton
loading={loading}
type="submit"
variant={
mode === 'dark'
Expand All @@ -528,24 +535,26 @@ const Auth = ({ setMode, mode, setIsModeChanged }) => {
}
>
Verify OTP
</Button>
</LoadingButton>
</form>
)}
<div className="auth__form-container_fields-account mt-3">
<p className="dark:text-gray-400">
{isSignup
? 'Already have an account?'
: "Dont't have an account?"}
<span
onClick={swicthMode}
className="ml-1 dark:text-blue-500 dark:hover:text-blue-700 underline"
>
{!OTPsend && (
<div className="auth__form-container_fields-account mt-3">
<p className="dark:text-gray-400">
{isSignup
? 'Sign Up'
: 'Sign In'}
</span>
</p>
</div>
? 'Already have an account?'
: "Dont't have an account?"}
<span
onClick={swicthMode}
className="ml-1 dark:text-blue-500 dark:hover:text-blue-700 underline"
>
{isSignup
? 'Sign Up'
: 'Sign In'}
</span>
</p>
</div>
)}
</p>
</div>
</Grid>
Expand Down
16 changes: 14 additions & 2 deletions client/src/components/channelContainer/EditChannel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ const EditChannel = ({ setIsEditing, createType }) => {
const [channelName, setChannelName] = useState(channel?.data?.name);
const [selectedUsers, setSelectedUsers] = useState([]);

const addedMembers = (users) => {
const addedUsers = [];
users.forEach((user) => {
addedUsers.push(user.name);
});

return addedUsers.toString();
};

const updateChannel = async (e) => {
e.preventDefault();

Expand All @@ -57,10 +66,13 @@ const EditChannel = ({ setIsEditing, createType }) => {
});
// eslint-disable-next-line no-unused-vars
const result = await channel.addMembers(selectedUsers, {
text: `${response.users[0].name} Added to party`,
text: `${
response.users.length === 1
? response.users[0].name
: addedMembers(response.users)
} Added to party`,
});
}

setChannelName(null);
setIsEditing(false);
setSelectedUsers([]);
Expand Down
Loading

0 comments on commit 5895966

Please sign in to comment.