Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit 5ee9139

Browse files
committed
🐛 Correction de quelques bugs et suppression de chakra-ui
1 parent b98aac9 commit 5ee9139

File tree

18 files changed

+375792
-526
lines changed

18 files changed

+375792
-526
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function index()
7878
'posts' => $posts,
7979
'tutorials' => $tutorials,
8080
'popularTutorials' => $popularTutorials
81-
]);
81+
])->withViewData(['title' => "Accueil"]);
8282
}
8383

8484
/**
@@ -88,7 +88,7 @@ public function index()
8888
*/
8989
public function privacy()
9090
{
91-
return Inertia::render('commons/Privacy');
91+
return Inertia::render('commons/Privacy')->withViewData(['title' => "Confidentialité"]);
9292
}
9393

9494
/**
@@ -98,7 +98,7 @@ public function privacy()
9898
*/
9999
public function terms()
100100
{
101-
return Inertia::render('commons/Terms');
101+
return Inertia::render('commons/Terms')->withViewData(['title' => "Conditions d'utilisation"]);
102102
}
103103

104104
/**
@@ -108,7 +108,11 @@ public function terms()
108108
*/
109109
public function slack()
110110
{
111-
return Inertia::render('commons/Slack');
111+
return Inertia::render('commons/Slack')
112+
->withViewData([
113+
'title' => "Rejoindre Slack",
114+
'description' => "Rejoignez notre slack pour discuter a propos de Laravel, Javascript, Design, comment demarrer et mener un projet de bout en bout, et découvrer l'univers du développement au Cameroun."
115+
]);
112116
}
113117

114118
/**

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"lint": "tsc --noEmit && eslint --ext .ts,.tsx --fix"
1212
},
1313
"dependencies": {
14-
"@chakra-ui/core": "^0.5.2",
15-
"@emotion/core": "^10.0.27",
16-
"@emotion/styled": "^10.0.27",
1714
"@grafikart/drop-files-element": "^1.0.9",
1815
"@inertiajs/inertia": "^0.1.7",
1916
"@inertiajs/inertia-react": "^0.1.4",
@@ -24,7 +21,6 @@
2421
"axios": "^0.19",
2522
"classnames": "^2.2.6",
2623
"date-fns": "^2.10.0",
27-
"emotion-theming": "^10.0.27",
2824
"filepond": "^4.12.0",
2925
"filepond-plugin-image-exif-orientation": "^1.0.6",
3026
"filepond-plugin-image-preview": "^4.6.1",
@@ -33,10 +29,12 @@
3329
"highlight.js": "^9.18.1",
3430
"laravel-mix": "^4.0.7",
3531
"laravel-mix-purgecss": "^4.2.0",
32+
"laravel-mix-tailwind": "^0.1.0",
3633
"lodash": "^4.17.13",
3734
"prismjs": "^1.19.0",
3835
"quill": "1.3.6",
3936
"react": "^16.12.0",
37+
"react-app-polyfill": "^1.0.6",
4038
"react-content-loader": "^5.0.2",
4139
"react-country-region-selector": "^2.0.0",
4240
"react-datepicker": "^2.13.0",
@@ -101,5 +99,17 @@
10199
"ts-loader": "^6.0.4",
102100
"typescript": "^3.5.3",
103101
"vue-template-compiler": "^2.6.10"
102+
},
103+
"browserslist": {
104+
"production": [
105+
">0.2%",
106+
"not dead",
107+
"not op_mini all"
108+
],
109+
"development": [
110+
"last 1 chrome version",
111+
"last 1 firefox version",
112+
"last 1 safari version"
113+
]
104114
}
105115
}

public/css/application.css

Lines changed: 178866 additions & 1 deletion
Large diffs are not rendered by default.

public/js/app.js

Lines changed: 147619 additions & 129 deletions
Large diffs are not rendered by default.

public/js/backend.js

Lines changed: 48931 additions & 59 deletions
Large diffs are not rendered by default.

public/mix-manifest.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"/js/app.js": "/js/app.js?id=55dec51a3bf9b41ffef4",
3-
"/css/application.css": "/css/application.css?id=6460c225c1513bfee32f",
4-
"/js/app.js.map": "/js/app.js.map?id=c51d3110c5c343ffa705",
5-
"/js/backend.js": "/js/backend.js?id=515555c10e07306c645b",
6-
"/js/backend.js.map": "/js/backend.js.map?id=a4f485ce092245d168d8"
2+
"/js/app.js": "/js/app.js",
3+
"/css/application.css": "/css/application.css",
4+
"/js/backend.js": "/js/backend.js"
75
}

resources/assets/ts/app.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from "react";
22
import { render } from "react-dom";
33
import { InertiaApp } from "@inertiajs/inertia-react";
4-
import { ThemeProvider } from "@chakra-ui/core";
54
import * as Sentry from '@sentry/browser';
5+
import 'react-app-polyfill/stable';
66
import "../sass/plugins.scss";
77

88
Sentry.init({
@@ -12,11 +12,9 @@ Sentry.init({
1212
const app: any = document.getElementById("app");
1313

1414
render(
15-
<ThemeProvider>
16-
<InertiaApp
17-
initialPage={JSON.parse(app.dataset.page)}
18-
resolveComponent={(name) => import(`./pages/${name}`).then((module) => module.default)}
19-
/>
20-
</ThemeProvider>,
15+
<InertiaApp
16+
initialPage={JSON.parse(app.dataset.page)}
17+
resolveComponent={(name) => import(`./pages/${name}`).then((module) => module.default)}
18+
/>,
2119
app,
2220
);
Lines changed: 66 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import React, { useState, useEffect } from "react";
22
import axios from "axios";
33
import { usePage, InertiaLink } from "@inertiajs/inertia-react";
4-
import { useToast } from "@chakra-ui/core";
54

65
import { NotificationType } from "@/utils/types";
76
import Notification from "@/components/Notification";
7+
import NotifyAlert from "@/components/NotifyAlert";
88

99
export default () => {
1010
const [isOpen, setIsOpen] = useState(false);
1111
const [notifications, setNotifications] = useState<NotificationType[]>([]);
1212
const { auth: { user } } = usePage();
13-
const toast = useToast();
13+
const [message, setMessage] = useState("");
14+
const [notify, setNotify] = useState(false);
1415

1516
useEffect(() => {
1617
setNotifications(user.notifications);
@@ -19,85 +20,80 @@ export default () => {
1920
function readNotification(e: React.SyntheticEvent, id: number) {
2021
e.preventDefault();
2122
axios.delete(`/notifications/${id}`).then((response) => {
22-
toast({
23-
position: `bottom-right`,
24-
description: `Notification marquée comme lue.`,
25-
status: `success`,
26-
duration: 2500,
27-
isClosable: true,
28-
});
23+
setNotify(true);
24+
setMessage("Notification marquée comme lue.");
25+
setTimeout(() => setNotify(false), 2500);
2926
setNotifications(response.data.notifications);
3027
}).catch((error) => {
31-
toast({
32-
position: `bottom-right`,
33-
description: `Impossible de marquée cette notification comme lue.`,
34-
status: `error`,
35-
duration: 2500,
36-
isClosable: true,
37-
});
28+
setNotify(true);
29+
setMessage("Impossible de marquée cette notification comme lue.");
30+
setTimeout(() => setNotify(false), 2500);
3831
console.error(error);
3932
});
4033
}
4134

4235
return (
43-
<div className="relative">
44-
<InertiaLink
45-
// onClick={() => setIsOpen(!isOpen)}
46-
href="/notifications"
47-
className="relative inline-flex p-1 border-2 border-transparent text-gray-600 rounded-full hover:text-gray-700 focus:outline-none focus:text-gray-700 focus:bg-gray-100 transition duration-150 ease-in-out z-10"
48-
>
49-
<svg className="h-7 w-7" stroke="currentColor" fill="none" viewBox="0 0 24 24">
50-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
51-
</svg>
52-
{notifications.length > 0 && (
53-
<span
54-
className="absolute h-5 w-5 flex items-center justify-center bg-brand-primary rounded-full text-white text-xs"
55-
style={{ top: "-5px", right: "-4px" }}
56-
>
57-
{notifications.length}
58-
</span>
59-
)}
60-
</InertiaLink>
61-
<button
62-
onClick={() => setIsOpen(false)}
63-
className={`fixed w-full h-full inset-0 bg-transparent cursor-default ${isOpen ? "" : "hidden"}`}
64-
tabIndex={-1}
65-
aria-label="Menu"
66-
/>
67-
<div
68-
className={`absolute right-0 rounded bg-white w-96 h-100 shadow-lg mt-2 ${isOpen ? "" : "hidden"}`}
69-
>
70-
<div className="p-3 bg-gray-50 text-gray-700 border-b border-gray-100 flex items-center">
71-
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" className="w-6 h-6 mr-2">
36+
<>
37+
<div className="relative">
38+
<InertiaLink
39+
// onClick={() => setIsOpen(!isOpen)}
40+
href="/notifications"
41+
className="relative inline-flex p-1 border-2 border-transparent text-gray-600 rounded-full hover:text-gray-700 focus:outline-none focus:text-gray-700 focus:bg-gray-100 transition duration-150 ease-in-out z-10"
42+
>
43+
<svg className="h-7 w-7" stroke="currentColor" fill="none" viewBox="0 0 24 24">
7244
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
7345
</svg>
74-
<span className="font-medium">Notifications</span>
75-
</div>
76-
<div id="notifications" className="overflow-y-auto h-80">
77-
{
78-
notifications.length > 0
79-
&& notifications.map((notification: NotificationType) => (
80-
<Notification
81-
key={notification.id}
82-
notification={notification}
83-
readNotification={readNotification}
84-
/>
85-
))
86-
}
87-
88-
{notifications.length === 0 && (
89-
<div className="h-80 flex flex-col items-center justify-center">
90-
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" className="w-10 h-10 mb-4">
91-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
92-
</svg>
93-
<small className="text-gray-500 text-lg">Aucune notification</small>
94-
</div>
46+
{notifications.length > 0 && (
47+
<span
48+
className="absolute h-5 w-5 flex items-center justify-center bg-brand-primary rounded-full text-white text-xs"
49+
style={{ top: "-5px", right: "-4px" }}
50+
>
51+
{notifications.length}
52+
</span>
9553
)}
96-
</div>
97-
<div className="p-3 bg-gray-50 text-gray-700 border-b border-gray-100 text-center">
98-
<a href="/notifications" className="font-medium">Toutes les notifications</a>
54+
</InertiaLink>
55+
<button
56+
onClick={() => setIsOpen(false)}
57+
className={`fixed w-full h-full inset-0 bg-transparent cursor-default ${isOpen ? "" : "hidden"}`}
58+
tabIndex={-1}
59+
aria-label="Menu"
60+
/>
61+
<div
62+
className={`absolute right-0 rounded bg-white w-96 h-100 shadow-lg mt-2 ${isOpen ? "" : "hidden"}`}
63+
>
64+
<div className="p-3 bg-gray-50 text-gray-700 border-b border-gray-100 flex items-center">
65+
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" className="w-6 h-6 mr-2">
66+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
67+
</svg>
68+
<span className="font-medium">Notifications</span>
69+
</div>
70+
<div id="notifications" className="overflow-y-auto h-80">
71+
{
72+
notifications.length > 0
73+
&& notifications.map((notification: NotificationType) => (
74+
<Notification
75+
key={notification.id}
76+
notification={notification}
77+
readNotification={readNotification}
78+
/>
79+
))
80+
}
81+
82+
{notifications.length === 0 && (
83+
<div className="h-80 flex flex-col items-center justify-center">
84+
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" className="w-10 h-10 mb-4">
85+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
86+
</svg>
87+
<small className="text-gray-500 text-lg">Aucune notification</small>
88+
</div>
89+
)}
90+
</div>
91+
<div className="p-3 bg-gray-50 text-gray-700 border-b border-gray-100 text-center">
92+
<a href="/notifications" className="font-medium">Toutes les notifications</a>
93+
</div>
9994
</div>
10095
</div>
101-
</div>
96+
<NotifyAlert show={notify} onClose={() => setNotify(false)} message={message} />
97+
</>
10298
);
10399
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from "react";
2+
import { InertiaLink, usePage } from "@inertiajs/inertia-react";
3+
4+
import Transition from "@/components/Transition";
5+
6+
export default ({ show, onClose, message }: { show: boolean; onClose: () => void; message: string }) => {
7+
const { auth: { user } } = usePage();
8+
9+
return (
10+
<Transition show={show}>
11+
<div className="fixed z-100 inset-0 flex items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-start sm:justify-end">
12+
<Transition
13+
enter="transform ease-out duration-300 transition"
14+
enterFrom="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
15+
enterTo="translate-y-0 opacity-100 sm:translate-x-0"
16+
leave="transition ease-in duration-100"
17+
leaveFrom="opacity-100"
18+
leaveTo="opacity-0"
19+
>
20+
<div className="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto">
21+
<div className="rounded-lg shadow-xs overflow-hidden">
22+
<div className="p-4">
23+
<div className="flex items-start">
24+
<div className="w-0 flex-1 flex justify-between">
25+
<p className="w-0 flex-1 text-sm leading-5 font-medium text-gray-900">
26+
{message}
27+
</p>
28+
{!user && (
29+
<InertiaLink href="/login" className="ml-3 flex-shrink-0 text-sm leading-5 font-medium text-brand-primary hover:text-brand-900 focus:outline-none focus:underline transition ease-in-out duration-150">
30+
Connexion
31+
</InertiaLink>
32+
)}
33+
</div>
34+
<div className="ml-4 flex-shrink-0 flex">
35+
<button onClick={onClose} className="inline-flex text-gray-400 focus:outline-none focus:text-gray-500 transition ease-in-out duration-150">
36+
<svg className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
37+
<path fillRule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clipRule="evenodd" />
38+
</svg>
39+
</button>
40+
</div>
41+
</div>
42+
</div>
43+
</div>
44+
</div>
45+
</Transition>
46+
</div>
47+
</Transition>
48+
);
49+
};

0 commit comments

Comments
 (0)