-
Notifications
You must be signed in to change notification settings - Fork 8
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: invite codes #77
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noctera
added
kind/enhancement
New feature or request
kind/dependencies
Pull requests that updates a dependency file
kind/ui
UI changes
kind/translations
labels
Sep 1, 2021
noctera
force-pushed
the
feature/invite-codes
branch
from
September 29, 2021 17:23
01d8049
to
c910844
Compare
luwol03
requested changes
Oct 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and tested. But I suggest the following changes to improve the style:
Suggestion
diff --git a/src/Components/InviteCode/InviteCode.jsx b/src/Components/InviteCode/InviteCode.jsx
index 69143ff..ee133d0 100644
--- a/src/Components/InviteCode/InviteCode.jsx
+++ b/src/Components/InviteCode/InviteCode.jsx
@@ -1,10 +1,9 @@
-import React, { useState, useCallback } from "react";
+import React, { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router";
import RemoveCircleOutlineIcon from "@material-ui/icons/RemoveCircleOutline";
-import Button from "../../Components/Button/Button.jsx";
import CountdownTimer from "../Timer/CountdownTimer.jsx";
import useSnack from "../../hooks/useSnack.js";
@@ -20,8 +19,6 @@ const InviteCode = ({ data }) => {
const history = useHistory();
const { showSnack } = useSnack();
- const [showDeleteButton, setShowDeleteButton] = useState(false);
-
const submitDeletion = useCallback(
(inviteCode) => {
deleteInviteCode(inviteCode)
@@ -46,20 +43,12 @@ const InviteCode = ({ data }) => {
}, [data.code, showSnack, t]);
return (
- <div
- className="invite-code"
- onMouseEnter={() => setShowDeleteButton(true)}
- onMouseLeave={() => setShowDeleteButton(false)}
- >
- <Button
- appearance={"red"}
- className={showDeleteButton ? "delete-btn-show" : "delete-btn-hide"}
- variant="transparent"
- >
+ <div className="invite-code">
+ <div className="delete-btn">
<RemoveCircleOutlineIcon onClick={() => submitDeletion(data.code)} />
- </Button>
- <div className="heading">
- <p onClick={copyToClip}>{data.code}</p>
+ </div>
+ <div className="heading" onClick={copyToClip}>
+ <p>{data.code}</p>
</div>
<hr />
<div className="information">
diff --git a/src/Components/InviteCode/InviteCode.scss b/src/Components/InviteCode/InviteCode.scss
index 0e4c829..aa5d6db 100644
--- a/src/Components/InviteCode/InviteCode.scss
+++ b/src/Components/InviteCode/InviteCode.scss
@@ -13,13 +13,18 @@
flex-direction: column;
position: relative;
- .delete-btn-show {
+ .delete-btn {
position: absolute;
- right: 0;
- top: 0;
- align-self: center;
- padding: 5px;
- border-radius: 100%;
+ right: 10px;
+ top: 10px;
+ color: $color-red;
+ opacity: 0;
+ transition: 100ms ease-in-out opacity;
+ cursor: pointer;
+ }
+
+ &:hover > .delete-btn {
+ opacity: 1;
}
.delete-btn-hide {
diff --git a/src/screens/Admin/Admin.jsx b/src/screens/Admin/Admin.jsx
index ec98ab1..1281a57 100644
--- a/src/screens/Admin/Admin.jsx
+++ b/src/screens/Admin/Admin.jsx
@@ -44,14 +44,17 @@ const Admin = () => {
<div className="admin">
{serverRegistrationLocked && (
<>
- <Button className="add-btn" variant="transparent">
- <AddCircleOutlinedIcon
- onClick={() => setShowInviteCodeModal(true)}
- />
- </Button>
- <div className="invite-code-field">
+ <div className="invite-code-controls">
+ <Button className="add-btn" variant="transparent">
+ <AddCircleOutlinedIcon
+ onClick={() => setShowInviteCodeModal(true)}
+ />
+ </Button>
+ </div>
+
+ <div className="invite-code-container">
{inviteCodes.map((inviteCode, index) => (
- <InviteCode key={index} data={inviteCode} />
+ <InviteCode key={inviteCode.code} data={inviteCode} />
))}
</div>
</>
diff --git a/src/screens/Admin/Admin.scss b/src/screens/Admin/Admin.scss
index 8ef98c1..293f8f6 100644
--- a/src/screens/Admin/Admin.scss
+++ b/src/screens/Admin/Admin.scss
@@ -1,20 +1,21 @@
.admin {
width: 100%;
- height: 100%;
- max-height: 100%;
- grid-area: main;
display: flex;
flex-direction: column;
align-items: center;
+ justify-content: center;
- .add-btn {
- margin: 20px 0;
+ .invite-code-controls {
+ .add-btn {
+ margin: 20px 0;
+ }
}
- .invite-code-field {
- width: 80%;
- display: grid;
- grid-template-columns: repeat(3, 33%);
- gap: 40px;
+ .invite-code-container {
+ display: flex;
+ padding: 20px;
+ flex-wrap: wrap;
+ gap: 10px;
+ // align-items: center;
}
}
src/Components/Indicators/ServerValidIndicator/ServerValidIndicator.jsx
Outdated
Show resolved
Hide resolved
src/Components/Indicators/ServerValidIndicator/ServerValidIndicator.jsx
Outdated
Show resolved
Hide resolved
src/Components/Indicators/ServerValidIndicator/ServerValidIndicator.jsx
Outdated
Show resolved
Hide resolved
luwol03
force-pushed
the
feature/invite-codes
branch
from
October 19, 2021 17:07
5f0bd56
to
3feef36
Compare
luwol03
approved these changes
Oct 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind/dependencies
Pull requests that updates a dependency file
kind/enhancement
New feature or request
kind/translations
kind/ui
UI changes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Client side implementation of the invite code structure.
To do:
Motivation and Context
Screenshots / GIFs (if appropriate):
Checklist
Resolves