From 6ce08f3fd59aa9477fe46658e39016b7efa0bf84 Mon Sep 17 00:00:00 2001 From: Melvyn Malherbe Date: Tue, 25 Feb 2020 16:21:44 +0100 Subject: [PATCH 1/2] Change --- .env | 3 ++- .gitignore | 3 ++- src/auth/Admin/AdminTools.tsx | 19 +++++++++++++++++++ src/auth/Create/ContentCreateUser.tsx | 4 +--- src/auth/User/ContentUserAccount.tsx | 21 +++++++++++++++++++-- src/auth/User/User.tsx | 19 ++++++++++++++++++- src/utils/adminHelper.ts | 3 +++ src/utils/authHelper.ts | 6 +++++- src/utils/constante.ts | 2 +- 9 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 src/auth/Admin/AdminTools.tsx create mode 100644 src/utils/adminHelper.ts diff --git a/.env b/.env index 2b3936e..6406497 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -PUBLIC_URL=/tools \ No newline at end of file +PUBLIC_URL=/tools +workbench.editor.limit.enabled = false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d5e345..1e7e313 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ yarn-debug.log* yarn-error.log* #perso -FireBase.tsx \ No newline at end of file +FireBase.tsx +/key diff --git a/src/auth/Admin/AdminTools.tsx b/src/auth/Admin/AdminTools.tsx new file mode 100644 index 0000000..39546ed --- /dev/null +++ b/src/auth/Admin/AdminTools.tsx @@ -0,0 +1,19 @@ +import React from "react"; +import { DialogTitle } from "@material-ui/core"; +import { TypeAuthDoc } from "../../utils/constante"; + + +type TypeAdminTools = { + auth: any; + authDoc: TypeAuthDoc; + onClose: Function; + onAdmin: Function; +}; + +export default function AdminTools({auth, authDoc, onClose, onAdmin}: TypeAdminTools) { + return ( + <> + Admin tools + + ); +} diff --git a/src/auth/Create/ContentCreateUser.tsx b/src/auth/Create/ContentCreateUser.tsx index 960f78c..e55f985 100644 --- a/src/auth/Create/ContentCreateUser.tsx +++ b/src/auth/Create/ContentCreateUser.tsx @@ -30,9 +30,7 @@ export default function ContentCreateUser({ const [helperEmail, setHelperEmail] = useState(""); const [helperUsername, setHelperUsername] = useState(""); const [helperPassword, setHelperPassword] = useState(""); - const [helperConfirmedPassword, setHelperConfirmedPassword] = useState< - string - >(""); + const [helperConfirmedPassword, setHelperConfirmedPassword] = useState(""); const submit = () => { const validationEmail = checkEmail(email); diff --git a/src/auth/User/ContentUserAccount.tsx b/src/auth/User/ContentUserAccount.tsx index 9ae96a8..37b1440 100644 --- a/src/auth/User/ContentUserAccount.tsx +++ b/src/auth/User/ContentUserAccount.tsx @@ -1,5 +1,10 @@ import React from "react"; -import { DialogTitle, DialogContent, DialogActions, Button } from "@material-ui/core"; +import { + DialogTitle, + DialogContent, + DialogActions, + Button +} from "@material-ui/core"; import { TypeAuthDoc } from "../../utils/constante"; import Uservalue from "../utils/Uservalue"; @@ -8,9 +13,16 @@ type TypeUserAccount = { authDoc: TypeAuthDoc; onClose: Function; onLogout: Function; + onAdmin: Function; }; -export default function UserAccount({ auth, onClose, authDoc, onLogout }: TypeUserAccount) { +export default function UserAccount({ + auth, + onClose, + authDoc, + onLogout, + onAdmin +}: TypeUserAccount) { return ( <> Hi {auth.displayName} @@ -22,6 +34,11 @@ export default function UserAccount({ auth, onClose, authDoc, onLogout }: TypeUs + {authDoc.group === "admin" && ( + + )} diff --git a/src/auth/User/User.tsx b/src/auth/User/User.tsx index 12f09a9..68d7a5e 100644 --- a/src/auth/User/User.tsx +++ b/src/auth/User/User.tsx @@ -5,6 +5,7 @@ import ContentUserAccount from "./ContentUserAccount"; import ContentLoginUser from "../Login/ContentLoginUser"; import ContentCreateUser from "../Create/ContentCreateUser"; import { TypeAuthDoc } from "../../utils/constante"; +import AdminTools from "../Admin/AdminTools"; type TypeCreateUser = { open: boolean; @@ -14,6 +15,7 @@ type TypeCreateUser = { export default function User({ open, onClose }: TypeCreateUser) { const [isLogin, setLogin] = useState(false); const [isCreate, setCreate] = useState(false); + const [adminTools, setAdminTools] = useState(false); const [auth, setAuth] = useState(); const [authDoc, setAuthDoc] = useState({ group: "", @@ -59,7 +61,22 @@ export default function User({ open, onClose }: TypeCreateUser) { return ( onClose()} fullWidth> {isLogin ? ( - + adminTools ? ( + setAdminTools(false)} + onClose={onClose} + auth={auth} + authDoc={authDoc} + /> + ) : ( + setAdminTools(true)} + /> + ) ) : isCreate ? ( toggleCreate(false)} /> ) : ( diff --git a/src/utils/adminHelper.ts b/src/utils/adminHelper.ts new file mode 100644 index 0000000..ba75a17 --- /dev/null +++ b/src/utils/adminHelper.ts @@ -0,0 +1,3 @@ +export function salut() { + console.log("salut"); +} diff --git a/src/utils/authHelper.ts b/src/utils/authHelper.ts index ab99dde..2672143 100644 --- a/src/utils/authHelper.ts +++ b/src/utils/authHelper.ts @@ -10,7 +10,7 @@ export function authHelper() { email: string, password: string, user: string, - callback: Function, + callback: Function ) { if (email && password) { auth @@ -46,6 +46,10 @@ export function authHelper() { } function getCollection(uid: string, callback: Function) { + db.collection("users") + .get() + .then((doc: any) => console.log("eoc", doc)); + return db .collection("users") .doc(uid) diff --git a/src/utils/constante.ts b/src/utils/constante.ts index f6c1cd7..9a7c60c 100644 --- a/src/utils/constante.ts +++ b/src/utils/constante.ts @@ -9,7 +9,7 @@ enum EnumRootDataBase { ninja = "chat_ninja" } -export const ROOT_DATABASE: EnumRootDataBase = EnumRootDataBase.prod; +export const ROOT_DATABASE: EnumRootDataBase = EnumRootDataBase.ninja; export type TypeTopic = { title: string; From 1b09f8c5ec5263b60481e4a269664ae3cc8ec588 Mon Sep 17 00:00:00 2001 From: Melvyn Malherbe Date: Tue, 3 Mar 2020 21:06:07 +0100 Subject: [PATCH 2/2] Fix some bog --- public/index.html | 2 +- src/components/github/CommitBox.tsx | 21 ++++++++++++++++++--- src/page/RandomSentence.tsx | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index 4a18e36..818a5a8 100644 --- a/public/index.html +++ b/public/index.html @@ -30,7 +30,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Melvyn App + VonQey diff --git a/src/components/github/CommitBox.tsx b/src/components/github/CommitBox.tsx index 8f90fe7..2f23b56 100644 --- a/src/components/github/CommitBox.tsx +++ b/src/components/github/CommitBox.tsx @@ -19,6 +19,9 @@ const useStyles = makeStyles((theme: Theme) => ({ "&:hover": { backgroundColor: theme.palette.divider } + }, + link: { + color: theme.palette.primary.main } })); @@ -55,13 +58,25 @@ export default function CommitBox({ value, index }: TypeCommitBox) { return ( - + {htmlUrl.length < 1 ? ( - + {value.commit.message} - + ) : ( + + + + {value.commit.message} + + + + )} ); } diff --git a/src/page/RandomSentence.tsx b/src/page/RandomSentence.tsx index 427ca35..29c6455 100644 --- a/src/page/RandomSentence.tsx +++ b/src/page/RandomSentence.tsx @@ -30,7 +30,7 @@ export default function RandomSentence() { const [settings, setSettings] = useState({ isCountDown: false, isOneSentence: false, - timerTime: 10 + timerTime: 3 }); const [openSettings, setOpenSettings] = useState(false);