Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8bb3c7d
chore: saving work
theMostCuriousHomunculus Feb 6, 2022
3176f69
chore: saving work
theMostCuriousHomunculus Feb 7, 2022
77e1c21
chore: saving work
theMostCuriousHomunculus Mar 9, 2022
f8fd4ab
feat: classy deck validation
theMostCuriousHomunculus Mar 10, 2022
ee5b3aa
chore: saving work
theMostCuriousHomunculus Mar 14, 2022
dbb47c3
chore: saving work
theMostCuriousHomunculus Mar 15, 2022
09bdcdb
chore: saving work
theMostCuriousHomunculus Mar 16, 2022
17a4c57
chore: saving work
theMostCuriousHomunculus Mar 16, 2022
6cc7b67
chore: saving work
theMostCuriousHomunculus Mar 17, 2022
68c71e2
chore: saving work
theMostCuriousHomunculus Mar 18, 2022
d87358d
chore: saving work
theMostCuriousHomunculus Mar 18, 2022
872f306
chore: saving work
theMostCuriousHomunculus Mar 20, 2022
bdcc8bc
chore: saving work
theMostCuriousHomunculus Mar 21, 2022
4b1e8e2
chore: saving work
theMostCuriousHomunculus Mar 21, 2022
561bd2e
chore: saving work
theMostCuriousHomunculus Mar 21, 2022
6417e4a
chore: saving work
theMostCuriousHomunculus Mar 24, 2022
d54242f
chore: saving work
theMostCuriousHomunculus Mar 28, 2022
823d24c
chore: saving work
theMostCuriousHomunculus Apr 1, 2022
17bff57
chore: saving work
theMostCuriousHomunculus Apr 2, 2022
c2dc80a
chore: saving work
theMostCuriousHomunculus Apr 4, 2022
8e34f25
chore: saving work
theMostCuriousHomunculus Apr 4, 2022
e55d4c6
chore: saving work
theMostCuriousHomunculus Apr 8, 2022
e37b432
chore: saving work
theMostCuriousHomunculus Apr 8, 2022
d7cad31
chore: saving work
theMostCuriousHomunculus Apr 9, 2022
dfc7e42
chore: saving work
theMostCuriousHomunculus Apr 10, 2022
23bac25
chore: saving work
theMostCuriousHomunculus Apr 11, 2022
9581844
chore: saving work
theMostCuriousHomunculus Apr 11, 2022
7daa09f
chore: saving work
theMostCuriousHomunculus Apr 13, 2022
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
10 changes: 6 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
// "ecmaFeatures": {
// "jsx": true
// },
"ecmaVersion": 2021,
// "presets": ["@babel/preset-react"],
"ecmaVersion": "latest",
"requireConfigFile": false,
"sourceType": "module"
},
Expand All @@ -40,14 +39,17 @@
"comma-dangle": "off",
"indent": "off",
"max-len": [
"error",
"warn",
{
"code": 100,
"ignoreComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
"ignoreTemplateLiterals": true,
"tabWidth": 2
}
],
"no-undef": "error",
"radix": ["error", "as-needed"],
"react/no-unescaped-entities": "off",
"react/prop-types": "off",
Expand Down
198 changes: 99 additions & 99 deletions .firebase/hosting.YnVpbGQ.cache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"jsxSingleQuote": false,
"printWidth": 80,
"printWidth": 100,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"rangeStart": 0,
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="title" content="Cube Level Mdinight" />
<meta name="og:title" content="Cube Level Midnight" />
<meta property="og:title" content="Cube Level Midnight" />
<meta
name="description"
content="Create, manage and draft Magic the Gathering cubes with your buds."
Expand Down
6 changes: 2 additions & 4 deletions public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ self.addEventListener('notificationclick', function (event) {
async function pullUpApp() {
const allClients = await clients.matchAll();
const hiddenApp = allClients.find(
(client) =>
client.url === notification.data.url &&
client.visibilityState === 'hidden'
(client) => client.url === notification.data.url && client.visibilityState === 'hidden'
);

if (hiddenApp) {
Expand Down Expand Up @@ -64,7 +62,7 @@ self.addEventListener('push', async function (event) {
data: {
url: data.url
},
icon: '/images/icon.png'
icon: data.icon ?? '/images/icon.png'
});
}
}
Expand Down
121 changes: 40 additions & 81 deletions src/components/Account Page/BudAccordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import MUITypography from '@mui/material/Typography';
import { makeStyles } from '@mui/styles';

import customSort from '../../functions/custom-sort';
import initiateBudRequest from '../../graphql/mutations/account/initiate-bud-request';
import respondToBudRequest from '../../graphql/mutations/account/respond-to-bud-request';
import revokeBudship from '../../graphql/mutations/account/revoke-budship';
import Avatar from '../miscellaneous/Avatar';
import ConfirmationDialog from '../miscellaneous/ConfirmationDialog';
import { AccountContext } from '../../contexts/account-context';
Expand Down Expand Up @@ -48,20 +51,10 @@ export default function BudAccordion() {
const { accountID } = useParams();
const classes = useStyles();
const {
accountState: {
buds,
nearby_users,
received_bud_requests,
sent_bud_requests
},
editAccount
accountState: { buds, nearby_users, received_bud_requests, sent_bud_requests }
} = useContext(AccountContext);
const { geolocationEnabled, userID } = useContext(AuthenticationContext);
const [budToDelete, setBudToDelete] = useState({
_id: null,
avatar: null,
name: null
});
const [budToDelete, setBudToDelete] = useState();
const [recommendedBuds, setRecommendedBuds] = useState([]);

useEffect(() => {
Expand Down Expand Up @@ -101,25 +94,19 @@ export default function BudAccordion() {
<React.Fragment>
<ConfirmationDialog
confirmHandler={() => {
editAccount(`action: "remove",\nother_user_id: "${budToDelete._id}"`);
setBudToDelete({ _id: null, avatar: null, name: null });
revokeBudship({
variables: { other_user_id: budToDelete ? budToDelete._id : '' }
});
setBudToDelete(null);
}}
open={!!budToDelete._id}
title={`Are you sure you want to un-bud ${budToDelete.name}?`}
toggleOpen={() =>
setBudToDelete({ _id: null, avatar: null, name: null })
}
open={!!budToDelete}
title={`Are you sure you want to un-bud ${budToDelete ? budToDelete.name : ''}?`}
toggleOpen={() => setBudToDelete(null)}
>
<div style={{ display: 'flex' }}>
<Avatar
alt={budToDelete.name}
size="medium"
src={budToDelete.avatar}
style={{ marginRight: 16 }}
/>
<Avatar profile={budToDelete} size="medium" style={{ marginRight: 16 }} />
<MUITypography variant="body1">
Think of all the good times you've had. And how lonely they'll be
without you.
Think of all the good times you've had. And how lonely they'll be without you.
</MUITypography>
</div>
</ConfirmationDialog>
Expand Down Expand Up @@ -149,9 +136,7 @@ export default function BudAccordion() {
horizontal: 'right',
vertical: 'top'
}}
badgeContent={
<MUIPersonAddIcon className={classes.badgeIcon} />
}
badgeContent={<MUIPersonAddIcon className={classes.badgeIcon} />}
className={classes.badge}
color="primary"
onClick={(event) => {
Expand All @@ -160,28 +145,22 @@ export default function BudAccordion() {
.closest('span')
.classList.contains('MuiBadge-colorPrimary')
) {
editAccount(
`action: "send",\nother_user_id: "${nearby_user._id}"`
);
initiateBudRequest({
variables: { other_user_id: nearby_user._id }
});
}
}}
overlap="circular"
>
<Link to={`/account/${nearby_user._id}`}>
<Avatar
alt={nearby_user.name}
size="medium"
src={nearby_user.avatar}
/>
<Avatar profile={nearby_user} size="medium" />
</Link>
</MUIBadge>
</MUIListItem>
))}
</MUIList>
) : (
<MUITypography variant="body1">
Determining Location...
</MUITypography>
<MUITypography variant="body1">Determining Location...</MUITypography>
)}
</React.Fragment>
)}
Expand All @@ -198,9 +177,7 @@ export default function BudAccordion() {
horizontal: 'right',
vertical: 'bottom'
}}
badgeContent={
<MUINotInterestedIcon className={classes.badgeIcon} />
}
badgeContent={<MUINotInterestedIcon className={classes.badgeIcon} />}
className={classes.badge}
color="secondary"
onClick={(event) => {
Expand All @@ -209,9 +186,9 @@ export default function BudAccordion() {
.closest('span')
.classList.contains('MuiBadge-colorSecondary')
) {
editAccount(
`action: "reject",\nother_user_id: "${request._id}"`
);
respondToBudRequest({
variables: { other_user_id: request._id, response: 'reject' }
});
}
}}
overlap="circular"
Expand All @@ -221,9 +198,7 @@ export default function BudAccordion() {
horizontal: 'right',
vertical: 'top'
}}
badgeContent={
<MUIPersonAddIcon className={classes.badgeIcon} />
}
badgeContent={<MUIPersonAddIcon className={classes.badgeIcon} />}
className={classes.badge}
color="primary"
onClick={(event) => {
Expand All @@ -232,19 +207,15 @@ export default function BudAccordion() {
.closest('span')
.classList.contains('MuiBadge-colorPrimary')
) {
editAccount(
`action: "accept",\nother_user_id: "${request._id}"`
);
respondToBudRequest({
variables: { other_user_id: request._id, response: 'accept' }
});
}
}}
overlap="circular"
>
<Link to={`/account/${request._id}`}>
<Avatar
alt={request.name}
size="medium"
src={request.avatar}
/>
<Avatar profile={request} size="medium" />
</Link>
</MUIBadge>
</MUIBadge>
Expand All @@ -261,11 +232,7 @@ export default function BudAccordion() {
return (
<MUIListItem key={request._id}>
<Link to={`/account/${request._id}`}>
<Avatar
alt={request.name}
size="medium"
src={request.avatar}
/>
<Avatar profile={request} size="medium" />
</Link>
</MUIListItem>
);
Expand All @@ -281,26 +248,22 @@ export default function BudAccordion() {
<MUIListItem key={pb._id}>
<MUIBadge
anchorOrigin={{ horizontal: 'right', vertical: 'top' }}
badgeContent={
<MUIPersonAddIcon className={classes.badgeIcon} />
}
badgeContent={<MUIPersonAddIcon className={classes.badgeIcon} />}
className={classes.badge}
color="primary"
onClick={(event) => {
if (
event.target
.closest('span')
.classList.contains('MuiBadge-colorPrimary')
event.target.closest('span').classList.contains('MuiBadge-colorPrimary')
) {
editAccount(
`action: "send",\nother_user_id: "${pb._id}"`
);
initiateBudRequest({
variables: { other_user_id: pb._id }
});
}
}}
overlap="circular"
>
<Link to={`/account/${pb._id}`}>
<Avatar alt={pb.name} size="medium" src={pb.avatar} />
<Avatar profile={pb} size="medium" />
</Link>
</MUIBadge>
</MUIListItem>
Expand All @@ -319,29 +282,25 @@ export default function BudAccordion() {
{accountID === userID ? (
<MUIBadge
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
badgeContent={
<MUIPersonRemoveIcon className={classes.badgeIcon} />
}
badgeContent={<MUIPersonRemoveIcon className={classes.badgeIcon} />}
className={classes.badge}
color="secondary"
onClick={(event) => {
if (
event.target
.closest('span')
.classList.contains('MuiBadge-colorSecondary')
event.target.closest('span').classList.contains('MuiBadge-colorSecondary')
) {
setBudToDelete(bud);
}
}}
overlap="circular"
>
<Link to={`/account/${bud._id}`}>
<Avatar alt={bud.name} size="medium" src={bud.avatar} />
<Avatar profile={bud} size="medium" />
</Link>
</MUIBadge>
) : (
<Link to={`/account/${bud._id}`}>
<Avatar alt={bud.name} size="medium" src={bud.avatar} />
<Avatar profile={bud} size="medium" />
</Link>
)}
</MUIListItem>
Expand Down
21 changes: 12 additions & 9 deletions src/components/Account Page/CubeAccordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ export default function CubeAccordion({ pageClasses }) {

return (
<React.Fragment>
<DeleteCubeForm
cubeToDelete={cubeToDelete}
setCubeToDelete={setCubeToDelete}
/>
<DeleteCubeForm cubeToDelete={cubeToDelete} setCubeToDelete={setCubeToDelete} />

<CreateCubeForm
open={showCreateCubeForm}
Expand Down Expand Up @@ -77,9 +74,17 @@ export default function CubeAccordion({ pageClasses }) {
>
{cube.image && (
<img
alt={cube.image.alt}
alt={
cube.image.image_uris
? cube.image.name
: cube.image.card_faces[0].name
}
height={50}
src={cube.image.src}
src={
cube.image.image_uris
? cube.image.image_uris.art_crop
: cube.image.card_faces[0].image_uris.art_crop
}
style={{ borderRadius: 4 }}
/>
)}
Expand All @@ -93,9 +98,7 @@ export default function CubeAccordion({ pageClasses }) {
<MUITableCell style={{ textAlign: 'right' }}>
<MUIIconButton
color="secondary"
onClick={() =>
setCubeToDelete({ _id: cube._id, name: cube.name })
}
onClick={() => setCubeToDelete({ _id: cube._id, name: cube.name })}
size="small"
>
<MUIDeleteForeverOutlinedIcon fontSize="large" />
Expand Down
Loading