Skip to content

Commit c03a199

Browse files
committed
Migrate web & fix moment errors
1 parent 82a4118 commit c03a199

File tree

12 files changed

+5085
-4275
lines changed

12 files changed

+5085
-4275
lines changed

apps/app/components/NinjaForm/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Typography,
1515
notification,
1616
} from "antd";
17-
import moment from "moment";
17+
import dayjs from "dayjs";
1818
import { CloseOutlined, SaveOutlined } from "@ant-design/icons";
1919
import * as api from "bokkenjs";
2020
import { notifyError, notifyInfo } from "~/components/Notification";
@@ -191,7 +191,7 @@ export default function NinjaForm({ id }) {
191191
name="ninja[birthday]"
192192
rules={[{ required: true }]}
193193
initialValue={
194-
id && ninja ? moment(ninja.birthday, "YYYY-MM-DD") : null
194+
id && ninja ? dayjs(ninja.birthday, "YYYY-MM-DD") : null
195195
}
196196
>
197197
<DatePicker />

apps/app/components/Profile/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
notification,
1313
} from "antd";
1414
import { ClockCircleOutlined, UserOutlined } from "@ant-design/icons";
15-
import moment from "moment";
16-
import "moment/locale/pt";
1715
import Badge from "~/components/Badge";
1816
import Belt from "~/components/Belt";
1917
import Document from "~/components/Document";
@@ -23,6 +21,11 @@ import { notifyError, notifyInfo } from "~/components/Notification";
2321
import styles from "./style.module.css";
2422
import { EUser } from "bokkenjs";
2523

24+
import dayjs from "dayjs";
25+
import relativeTime from "dayjs/plugin/relativeTime";
26+
dayjs.extend(relativeTime);
27+
import "dayjs/locale/pt";
28+
2629
import { BsFileEarmarkPersonFill } from "react-icons/bs";
2730

2831
import { getIcon } from "~/lib/utils";
@@ -97,7 +100,7 @@ function Profile({ id, role }: Props) {
97100
}, [id, role]);
98101

99102
useEffect(() => {
100-
setDate(moment(info.since).format("DD/MM/YYYY"));
103+
setDate(dayjs(info.since).format("DD/MM/YYYY"));
101104
}, [info]);
102105

103106
return (
@@ -175,7 +178,7 @@ function Profile({ id, role }: Props) {
175178
<Timeline mode="alternate">
176179
<Timeline.Item dot={<ClockCircleOutlined />}>
177180
Registou-se na plataforma{" "}
178-
{moment(info.since).locale("pt").fromNow()}
181+
{dayjs(info.since).locale("pt").fromNow()}
179182
</Timeline.Item>
180183
</Timeline>
181184
</TabPane>

apps/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@netlify/plugin-nextjs": "^4.29.2",
2121
"antd": "^5.0.0",
2222
"bokkenjs": "*",
23+
"dayjs": "^1.11.7",
2324
"lodash-es": "^4.17.21",
24-
"moment": "^2.29.4",
2525
"next": "^12.3.4",
2626
"react": "17.0.2",
2727
"react-dom": "17.0.2",

apps/app/pages/_app.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,19 @@ function Shuriken({ Component, pageProps }: AppProps) {
6262
};
6363

6464
return (
65-
<ConfigProvider
66-
form={{ validateMessages }}
67-
locale={ptPT}
68-
theme={{
69-
token: {
70-
colorPrimary: "#722ed1",
71-
},
72-
}}
73-
>
74-
<ThemeProvider>
75-
<QueryClientProvider client={queryClient}>
65+
<ThemeProvider>
66+
<QueryClientProvider client={queryClient}>
67+
<ConfigProvider form={{ validateMessages }} locale={ptPT}>
7668
<AuthProvider>
7769
<Head>
7870
<title>CoderDojo Braga</title>
7971
</Head>
8072
<Component {...pageProps} />
81-
<ReactQueryDevtools position="bottom-right" />
8273
</AuthProvider>
83-
</QueryClientProvider>
84-
</ThemeProvider>
85-
</ConfigProvider>
74+
</ConfigProvider>
75+
<ReactQueryDevtools position="bottom-right" />
76+
</QueryClientProvider>
77+
</ThemeProvider>
8678
);
8779
}
8880

apps/app/pages/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useEvents } from "~/hooks/events";
1111
import { notifyError } from "~/components/Notification";
1212

1313
import styles from "~/styles/Dashboard.module.css";
14-
import moment from "moment";
14+
import dayjs from "dayjs";
1515

1616
const { Title } = Typography;
1717

@@ -24,7 +24,7 @@ function Dashboard() {
2424
const { data: badges, isLoading: isLoadingBadges } = useBadges();
2525

2626
const nextEvent = () => {
27-
const cur = moment();
27+
const cur = dayjs();
2828

2929
const sorted_events = events
3030
.filter((e: any) => cur.diff(e.start_time) < 0)

apps/app/pages/lecture/[id].tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as api from "bokkenjs";
1616
import { useAuth } from "@coderdojobraga/ui";
1717
import { withAuth } from "~/components/Auth";
1818
import AppLayout from "~/layouts/AppLayout";
19-
import moment from "moment";
19+
import dayjs from "dayjs";
2020
import { EUser } from "bokkenjs";
2121
import { notifyError, notifyInfo } from "~/components/Notification";
2222

@@ -115,7 +115,7 @@ function Lectures() {
115115
<Col>
116116
<Text>
117117
{!lecture.event ||
118-
moment(new Date(lecture.event.start_time)).format("DD/MM/YYYY")}
118+
dayjs(new Date(lecture.event.start_time)).format("DD/MM/YYYY")}
119119
</Text>
120120
</Col>
121121
</Row>

apps/app/pages/lectures/[role]/[id].tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CalendarOutlined, EditOutlined } from "@ant-design/icons";
66
import { withAuth } from "~/components/Auth";
77
import AppLayout from "~/layouts/AppLayout";
88
import * as api from "bokkenjs";
9-
import moment from "moment";
9+
import dayjs from "dayjs";
1010
import { EUser } from "bokkenjs";
1111
import { notifyError } from "~/components/Notification";
1212

@@ -94,7 +94,7 @@ function Lectures() {
9494
</Col>
9595
<Col>
9696
<Text>
97-
{moment(new Date(lecture.event.start_time)).format(
97+
{dayjs(new Date(lecture.event.start_time)).format(
9898
"DD/MM/YYYY"
9999
)}
100100
</Text>

apps/app/pages/settings.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Upload,
1515
notification,
1616
} from "antd";
17-
import moment from "moment";
17+
import dayjs from "dayjs";
1818
import {
1919
MinusCircleOutlined,
2020
PlusOutlined,
@@ -291,8 +291,8 @@ function Settings() {
291291
<DatePicker
292292
showToday={false}
293293
defaultValue={
294-
(user?.birthday && moment(user.birthday, "YYYY-MM-DD")) ||
295-
moment()
294+
(user?.birthday && dayjs(user.birthday, "YYYY-MM-DD")) ||
295+
dayjs()
296296
}
297297
/>
298298
</Form.Item>

apps/blog/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"antd": "^4.23.1",
1818
"gray-matter": "^4.0.3",
1919
"lodash-es": "^4.17.21",
20+
"moment": "^2.29.4",
2021
"next": "^12.3.4",
2122
"react": "17.0.2",
2223
"react-dom": "17.0.2",

apps/web/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"dev": "npm run less:build && npm run next:dev",
7-
"build": "npm run less:build && npm run next:build",
6+
"dev": "npm run next:dev",
7+
"build": "npm run next:build",
88
"start": "next start",
99
"lint": "npm run lint:fix",
1010
"lint:fix": "next lint --fix",
1111
"lint:check": "next lint",
1212
"next": "next",
1313
"next:build": "next build",
14-
"next:dev": "next dev",
15-
"less:build": "lessc --js styles/antd.less styles/antd.css"
14+
"next:dev": "next dev"
1615
},
1716
"dependencies": {
1817
"@ant-design/icons": "^4.7.0",
1918
"@coderdojobraga/ui": "*",
2019
"@heroicons/react": "^2.0.8",
2120
"@netlify/plugin-nextjs": "^4.29.2",
22-
"antd": "^4.23.1",
21+
"antd": "^5.0.0",
2322
"next": "^12.3.4",
2423
"react": "17.0.2",
2524
"react-dom": "17.0.2"
@@ -31,7 +30,6 @@
3130
"autoprefixer": "^10.4.8",
3231
"eslint": "^8.23.0",
3332
"eslint-config-coderdojobraga": "*",
34-
"less": "^4.1.3",
3533
"next-transpile-modules": "9.0.0",
3634
"postcss": "^8.4.16",
3735
"tailwind-config-coderdojobraga": "*",

apps/web/styles/antd.less

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)