Skip to content

Ajout d'un formulaire de contact #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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PUBLIC_URL=/tools
PUBLIC_URL=/tools
workbench.editor.limit.enabled = false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ yarn-debug.log*
yarn-error.log*

#perso
FireBase.tsx
FireBase.tsx
/key
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
-->
<title>Melvyn App</title>
<title>VonQey</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
19 changes: 19 additions & 0 deletions src/auth/Admin/AdminTools.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { DialogTitle } from "@material-ui/core";
import { TypeAuthDoc } from "../../utils/constante";


type TypeAdminTools = {
auth: any;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce type devrait être définit !

authDoc: TypeAuthDoc;
onClose: Function;
onAdmin: Function;
};

export default function AdminTools({auth, authDoc, onClose, onAdmin}: TypeAdminTools) {
return (
<>
<DialogTitle>Admin tools</DialogTitle>
</>
);
}
4 changes: 1 addition & 3 deletions src/auth/Create/ContentCreateUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export default function ContentCreateUser({
const [helperEmail, setHelperEmail] = useState<string>("");
const [helperUsername, setHelperUsername] = useState<string>("");
const [helperPassword, setHelperPassword] = useState<string>("");
const [helperConfirmedPassword, setHelperConfirmedPassword] = useState<
string
>("");
const [helperConfirmedPassword, setHelperConfirmedPassword] = useState<string>("");

const submit = () => {
const validationEmail = checkEmail(email);
Expand Down
21 changes: 19 additions & 2 deletions src/auth/User/ContentUserAccount.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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 (
<>
<DialogTitle>Hi {auth.displayName}</DialogTitle>
Expand All @@ -22,6 +34,11 @@ export default function UserAccount({ auth, onClose, authDoc, onLogout }: TypeUs
</Uservalue>
</DialogContent>
<DialogActions>
{authDoc.group === "admin" && (
<Button color="primary" onClick={() => onAdmin()}>
Admins tools
</Button>
)}
<Button color="primary" onClick={() => onLogout()}>
Logout
</Button>
Expand Down
19 changes: 18 additions & 1 deletion src/auth/User/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,6 +15,7 @@ type TypeCreateUser = {
export default function User({ open, onClose }: TypeCreateUser) {
const [isLogin, setLogin] = useState<boolean>(false);
const [isCreate, setCreate] = useState<boolean>(false);
const [adminTools, setAdminTools] = useState<boolean>(false);
const [auth, setAuth] = useState<any>();
const [authDoc, setAuthDoc] = useState<TypeAuthDoc>({
group: "",
Expand Down Expand Up @@ -59,7 +61,22 @@ export default function User({ open, onClose }: TypeCreateUser) {
return (
<Dialog open={open} onClose={() => onClose()} fullWidth>
{isLogin ? (
<ContentUserAccount onClose={onClose} auth={auth} authDoc={authDoc} onLogout={onLogout} />
adminTools ? (
<AdminTools
onAdmin={() => setAdminTools(false)}
onClose={onClose}
auth={auth}
authDoc={authDoc}
/>
) : (
<ContentUserAccount
onClose={onClose}
auth={auth}
authDoc={authDoc}
onLogout={onLogout}
onAdmin={() => setAdminTools(true)}
/>
)
) : isCreate ? (
<ContentCreateUser onClose={onClose} onLogin={() => toggleCreate(false)} />
) : (
Expand Down
21 changes: 18 additions & 3 deletions src/components/github/CommitBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const useStyles = makeStyles((theme: Theme) => ({
"&:hover": {
backgroundColor: theme.palette.divider
}
},
link: {
color: theme.palette.primary.main
}
}));

Expand Down Expand Up @@ -55,13 +58,25 @@ export default function CommitBox({ value, index }: TypeCommitBox) {

return (
<Box onMouseEnter={findUrl} className={classes.mainBox}>
<Link href={htmlUrl} className="removeUnderline customHoverLink" target="_blank">
{htmlUrl.length < 1 ? (
<Box width="100%" maxWidth={340}>
<Typography noWrap variant="body1" className="customHoverLink">
<Typography noWrap variant="body1" className={classes.link}>
{value.commit.message}
</Typography>
</Box>
</Link>
) : (
<Link
href={htmlUrl}
className="removeUnderline customHoverLink"
target="_blank"
>
<Box width="100%" maxWidth={340}>
<Typography noWrap variant="body1" className={classes.link}>
{value.commit.message}
</Typography>
</Box>
</Link>
)}
</Box>
);
}
2 changes: 1 addition & 1 deletion src/page/RandomSentence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function RandomSentence() {
const [settings, setSettings] = useState<TypeSettings>({
isCountDown: false,
isOneSentence: false,
timerTime: 10
timerTime: 3
});
const [openSettings, setOpenSettings] = useState<boolean>(false);

Expand Down
3 changes: 3 additions & 0 deletions src/utils/adminHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function salut() {
console.log("salut");
}
6 changes: 5 additions & 1 deletion src/utils/authHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function authHelper() {
email: string,
password: string,
user: string,
callback: Function,
callback: Function
) {
if (email && password) {
auth
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constante.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down