Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ntgl 820 create friend group modal #822

Draft
wants to merge 79 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a1eb47a
implemented friend group modal
Apr 24, 2024
19d360f
customized chip selected
Apr 24, 2024
449997b
added tooltip for tags on selected friends
Apr 24, 2024
5268de7
removed close button styling
Apr 24, 2024
ca04727
clean up code and fixed darkmode appearance
Apr 25, 2024
2e7971f
fixed lint issues
Apr 25, 2024
9765940
added new package: react-draggable-list and created a basic draggable…
Apr 30, 2024
a399e34
displayed group image and group name in a tooltip
May 1, 2024
1e54dc1
changed group image to take in a image address instead of file upload
May 2, 2024
81f6d4c
removed pointer over image circle
May 2, 2024
d318452
created a new folder: sidebar/addGroupDialgo and decomposed AddGroupD…
May 2, 2024
575007f
removed inline styling cuz ray is a butt about it
May 2, 2024
c08e1e9
added background colour to sidebar
May 2, 2024
9d89faa
oidc tests
Rayahhhmed May 10, 2024
1407cb1
added nestjs support with auto timetabling
Rayahhhmed May 10, 2024
5c53bc6
added nestjs support with auto timetabling
Rayahhhmed May 10, 2024
ae0e8c7
removing controller test files for main app
Rayahhhmed May 10, 2024
0a926a7
testing out no frozen lockfile for docker image
Rayahhhmed May 10, 2024
f6c15dd
Update ci.yml
Rayahhhmed May 10, 2024
9af7d36
added the old endpoints: Auth user, prisma and user as well as the pr…
Rayahhhmed May 11, 2024
bc0b681
TLS error potentially caused by UNSW IT not renewing cert
Rayahhhmed May 11, 2024
d45b109
updating dockerignore to ignore extra bloat and gitignore to ignore m…
Rayahhhmed May 12, 2024
18a4de6
Updated format for files
Rayahhhmed May 12, 2024
7e18c5c
Prisma migration removed for now
Rayahhhmed May 12, 2024
18f3808
added example env files
Rayahhhmed May 12, 2024
adebb6a
Add PUT user/profile endpoint, and complete PUT user settings endpoint
M7s7 May 13, 2024
b8e1215
Complete POST timetable endpoint
M7s7 May 13, 2024
04f65d2
Edit timetable endpoint completed (not tested though lol - will do la…
M7s7 May 13, 2024
a5bf4d1
GET profile endpoint fixed and completed
M7s7 May 14, 2024
82b890b
Complete GET settings endpoint
M7s7 May 14, 2024
95c0fb8
GET timetable is working now
M7s7 May 14, 2024
68ace61
Delete timetable endpoint completed
M7s7 May 14, 2024
28ede1b
added better mapping for sql name convention
Rayahhhmed May 19, 2024
5ed1842
Add friend/unfriend endpoints
M7s7 May 20, 2024
d8ac30e
Add friends get req
M7s7 May 20, 2024
f392753
Friend request endpoints completed
M7s7 May 22, 2024
2324ca3
resolved merge conflicts
May 24, 2024
22951f6
added a toggle for choosing private or public group
May 24, 2024
8f8be4d
fixed styling of group privacy to a select menu
May 25, 2024
48c1a93
added groups endpoints
Rayahhhmed May 25, 2024
31b6bcb
added all the endpoints
Rayahhhmed May 25, 2024
ad72ad0
group post merged
Rayahhhmed May 26, 2024
1d239c9
added seed script
Rayahhhmed May 26, 2024
c22f262
added seed script
Rayahhhmed May 26, 2024
6cb13d7
adding some minor changes with source copying
Rayahhhmed May 26, 2024
0f3b5e7
seed file was causing crashes
Rayahhhmed May 26, 2024
6d92dc0
testing out types
Rayahhhmed May 26, 2024
5d1cf20
adding ci prisma gen
Rayahhhmed May 26, 2024
fececcc
fixed merge conflicts
Rayahhhmed May 26, 2024
cba92de
added server config
Rayahhhmed May 26, 2024
748af31
Merge branch 'feature/NTGL-820-create-friend-group-modal' into ntgl-g…
Rayahhhmed May 26, 2024
8b710b2
can call BE for groups
Rayahhhmed May 26, 2024
a0c2cf4
Resolve for promise return creation of groups added
Rayahhhmed May 27, 2024
01c6297
removed the extra files
Rayahhhmed May 28, 2024
af4432f
added the group dialog file again
Rayahhhmed May 28, 2024
3aafd26
testing new deletions
Rayahhhmed May 28, 2024
e6d1a48
moved prisma stuff to its own separate folder
Rayahhhmed May 28, 2024
d3f5a66
changed around server files
Rayahhhmed May 28, 2024
446b15c
cleaned up service
Rayahhhmed May 28, 2024
97127aa
Merge branch 'dev' into feature/NTGL-820-create-friend-group-modal
May 30, 2024
6d6c536
new models
Rayahhhmed May 31, 2024
57d7a32
Merge branch 'ntgl-group-creation' into feature/NTGL-820-create-frien…
May 31, 2024
c9e5a73
merged rays backend and displaying group side bar
May 31, 2024
d3dd5b1
placeholder for getGroups function when a new group is created
May 31, 2024
209e91b
added notangles logo as the default image for creating a new group
Jun 1, 2024
ca1d37b
fixed handleclose for resetting group image
Jun 1, 2024
d8ee887
disabled create button when input is invalid and display red error af…
Jun 2, 2024
ea62310
refactored group object
Jun 6, 2024
8400e05
fixed closing modal and resetting object
Jun 6, 2024
7ea238c
resolved merge conflicts
Jun 6, 2024
dc3cdfe
TEMPORARY hard coded side bar
Jun 13, 2024
4e0d043
added context menu to friends sidebar
nikkichins Jun 20, 2024
93c2ea4
fixed style and removed cursor style
nikkichins Jun 20, 2024
1012c68
groups sidebar
Jun 30, 2024
b9bf79c
resolved merge
Jun 30, 2024
db4a012
changed group interface
Jun 30, 2024
f9c5c0f
added styling to icons sidebar
nikkichins Jul 5, 2024
6bc9312
added lock file
nikkichins Jul 5, 2024
138b768
Merge branch 'dev' into feature/NTGL-820-create-friend-group-modal
nikkichins Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Changelog from './Changelog';
import CustomModal from './CustomModal';
import Privacy from './Privacy';
import Settings from './Settings';
import AddGroupButton from '../sidebar/addGroupDialog/AddGroupDialog';

const LogoImg = styled('img')`
height: 46px;
Expand Down Expand Up @@ -82,6 +83,7 @@ const Navbar: React.FC = () => {
content={<Privacy />}
/>
<CustomModal title="Settings" showIcon={<SettingsIcon />} description={'Settings'} content={<Settings />} />
<AddGroupButton />
</Toolbar>
</StyledNavBar>
</NavbarBox>
Expand Down
53 changes: 53 additions & 0 deletions client/src/components/sidebar/addGroupDialog/AddGroupDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React, { useState } from 'react';
import { Add as AddIcon } from '@mui/icons-material';
import { Dialog, IconButton, Tooltip } from '@mui/material';
import AddGroupDialogActions from './AddGroupDialogActions';
import AddGroupDialogTitle from './AddGroupDialogTitle';
import AddGroupDialogContent from './AddGroupDialogContent';


export interface FriendType {
name: string;
zID: number;
}

const AddGroupDialog = () => {
const [isOpen, setIsOpen] = useState(false);
const [groupName, setGroupName] = useState('');
const [selectedFriends, setSelectedFriends] = useState<FriendType[]>([]);
const [groupImageURL, setGroupImageURL] = useState('');

const handleCreateGroup = () => {
// TODO call API
};

const handleClose = () => {
setIsOpen(false);
setGroupName('');
setSelectedFriends([]);
setGroupImageURL('');
};

return (
<>
<Tooltip title="Add a Group">
<IconButton color="inherit" onClick={() => setIsOpen(true)}>
<AddIcon />
</IconButton>
</Tooltip>

<Dialog disableScrollLock onClose={handleClose} open={isOpen} fullWidth maxWidth="sm">
<AddGroupDialogTitle handleClose={handleClose} />
<AddGroupDialogContent
groupImageURL={groupImageURL}
setGroupImageURL={setGroupImageURL}
setGroupName={setGroupName}
setSelectedFriends={setSelectedFriends}
/>
<AddGroupDialogActions handleClose={handleClose} handleCreateGroup={handleCreateGroup} />
</Dialog>
</>
);
};

export default AddGroupDialog;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import { Button, DialogActions } from '@mui/material';
import { styled } from '@mui/system';


const StyledDialogActions = styled(DialogActions)`
background-color: ${({ theme }) => theme.palette.background.paper};
padding: 0px 60px 30px 0px;
`;

interface AddGroupDialogActionsProps {
handleClose: () => void;
handleCreateGroup: () => void;
}

const AddGroupDialogActions: React.FC<AddGroupDialogActionsProps> = ({ handleClose, handleCreateGroup }) => {
return (
<StyledDialogActions>
<Button variant="text" onClick={handleClose}>
Cancel
</Button>
<Button variant="contained" onClick={handleCreateGroup}>
Create
</Button>
</StyledDialogActions>
);
};

export default AddGroupDialogActions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React from 'react';
import { CheckCircle as CheckCircleIcon, RadioButtonUnchecked as RadioButtonUncheckedIcon } from '@mui/icons-material';
import { Autocomplete, Checkbox, Chip, DialogContent, TextField, Tooltip } from '@mui/material';
import { styled } from '@mui/system';
import EditImagePopOver from './EditImagePopOver';
import { friends } from './dummyData';
import { FriendType } from './AddGroupDialog';


const StyledDialogContent = styled(DialogContent)`
background-color: ${({ theme }) => theme.palette.background.paper};
padding: 40px 60px;
gap: 20px;
display: flex;
flex-direction: column;
align-items: center;
`;

const Circle = `
width: 150px;
height: 150px;
border-radius: 999px;
`;

const CircleOutline = styled('div')`
${Circle}
border: 1px solid gray;
`;

const CircleImage = styled('img')`
${Circle}
object-fit: cover;
`;

const StyledUploadImageContainer = styled('div')`
display: flex;
flex-direction: column;
align-items: flex-end;
`;

interface AddGroupDialoContentProps {
jasttran marked this conversation as resolved.
Show resolved Hide resolved
groupImageURL: string;
setGroupImageURL: (url: string) => void;
setGroupName: (groupName: string) => void;
setSelectedFriends: (friends: FriendType[]) => void;
}

const AddGroupDialogContent: React.FC<AddGroupDialoContentProps> = ({
groupImageURL,
setGroupImageURL,
setGroupName,
setSelectedFriends,
}) => {
return (
<StyledDialogContent>
<StyledUploadImageContainer>
<label>
<CircleOutline>{<CircleImage src={groupImageURL} />}</CircleOutline>
</label>
<EditImagePopOver groupImageURL={groupImageURL} setGroupImageURL={setGroupImageURL} />
</StyledUploadImageContainer>

<TextField
label="Group Name"
variant="outlined"
required
fullWidth
onChange={(e) => setGroupName(e.target.value)}
/>

<Autocomplete
multiple
options={friends}
disableCloseOnSelect
fullWidth
onChange={(_, value) => setSelectedFriends(value)}
getOptionLabel={(option) => option.name}
renderOption={(props, option, { selected }) => (
<li {...props}>
<Checkbox
icon={<RadioButtonUncheckedIcon fontSize="small" />}
checkedIcon={<CheckCircleIcon fontSize="small" />}
style={{ marginRight: 8 }}
checked={selected}
/>
{option.name}
</li>
)}
renderTags={(tagValue, getTagProps) => {
return tagValue.map((option, index) => (
<Tooltip title={'z' + option.zID}>
<Chip {...getTagProps({ index })} label={option.name} />
</Tooltip>
));
}}
renderInput={(params) => <TextField {...params} label="Group Members" placeholder="Search for names..." />}
/>
</StyledDialogContent>
);
};

export default AddGroupDialogContent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Close as CloseIcon } from '@mui/icons-material';
import { DialogTitle, IconButton, Typography } from '@mui/material';
import { styled } from '@mui/system';


const StyledDialogTitle = styled(DialogTitle)`
background-color: ${({ theme }) => theme.palette.background.paper};
padding: 40px;
display: flex;
flex-direction: row;
justify-content: space-between;
`;

interface AddGroupDialogTitleProps {
handleClose: () => void;
}

const AddGroupDialogTitle: React.FC<AddGroupDialogTitleProps> = ({ handleClose }) => {
return (
<>
<StyledDialogTitle>
<Typography variant="h6">Create a Group</Typography>
<div>
<IconButton onClick={handleClose}>
<CloseIcon />
</IconButton>
</div>
</StyledDialogTitle>
</>
);
};

export default AddGroupDialogTitle;
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Edit as EditIcon } from '@mui/icons-material';
import { IconButton, Popover, TextField } from '@mui/material';
import { styled } from '@mui/system';
import React from 'react';

const EditIconCircle = styled('div')`
background-color: ${({ theme }) => theme.palette.background.paper};
border: 1px solid gray;
border-radius: 999px;
width: 35px;
height: 35px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
top: -35px;
cursor: pointer;
&:hover {
border: ${({ theme }) => (theme.palette.mode === 'light' ? '1px solid black' : '1px solid white;')};
}
`;

const StyledPopoverContent = styled('div')`
width: 400px;
`;

interface EditImagePopOverProps {
groupImageURL: string;
setGroupImageURL: (url: string) => void;
}

const EditImagePopOver: React.FC<EditImagePopOverProps> = ({ groupImageURL, setGroupImageURL }) => {
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);

return (
<EditIconCircle>
<div>
<IconButton onClick={(e) => setAnchorEl(e.currentTarget)}>
<EditIcon />
</IconButton>

<Popover
open={Boolean(anchorEl)}
anchorEl={anchorEl}
onClose={() => setAnchorEl(null)}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'left',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
>
<StyledPopoverContent>
<TextField
placeholder="Enter image address..."
variant="outlined"
value={groupImageURL}
fullWidth
onChange={(e) => setGroupImageURL(e.target.value)}
/>
</StyledPopoverContent>
</Popover>
</div>
</EditIconCircle>
);
};

export default EditImagePopOver;
13 changes: 13 additions & 0 deletions client/src/components/sidebar/addGroupDialog/dummyData.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FriendType } from "./AddGroupDialog";


export const friends: FriendType[] = [
{ name: 'Shaam', zID: 532445 },
{ name: 'Ray', zID: 523495 },
{ name: 'hhlu', zID: 584290 },
{ name: 'Sohum', zID: 523840 },
{ name: 'Chanel', zID: 542567 },
{ name: 'Nikki', zID: 524596 },
{ name: 'Micky', zID: 523948 },
{ name: 'Jasmine', zID: 540938 },
];