Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-box
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
青山
ai-box
Commits
d562dab4
Commit
d562dab4
authored
Apr 01, 2025
by
fisherdaddy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add new AI events to data source
parent
084937e6
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
6 deletions
+132
-6
AITimeline.jsx
src/components/AITimeline.jsx
+13
-6
ai-events.json
src/data/ai-events.json
+119
-0
No files found.
src/components/AITimeline.jsx
View file @
d562dab4
...
...
@@ -19,7 +19,9 @@ const categories = [
const
formatDate
=
(
dateString
)
=>
{
const
date
=
new
Date
(
dateString
);
return
date
.
toLocaleDateString
(
'en-US'
,
{
month
:
'short'
,
day
:
'numeric'
});
const
month
=
date
.
getMonth
()
+
1
;
// Months are 0-based
const
day
=
date
.
getDate
();
return
`
${
month
}
.
${
day
}
`
;
};
const
getCategoryClass
=
(
categoryArray
)
=>
{
...
...
@@ -48,6 +50,16 @@ const AITimeline = () => {
const
isLoading
=
usePageLoading
();
const
[
selectedCategory
,
setSelectedCategory
]
=
useState
(
'all'
);
const
[
groupedEventsByDate
,
setGroupedEventsByDate
]
=
useState
([]);
const
[
lastUpdatedDate
,
setLastUpdatedDate
]
=
useState
(
null
);
// Set the last updated date once on component mount
useEffect
(()
=>
{
// Sort events by date descending to get the most recent event
const
sortedEvents
=
[...
events
].
sort
((
a
,
b
)
=>
new
Date
(
b
.
date
)
-
new
Date
(
a
.
date
));
if
(
sortedEvents
.
length
>
0
)
{
setLastUpdatedDate
(
formatLastUpdatedDate
(
sortedEvents
[
0
].
date
));
}
},
[]);
// Group events by date after sorting descendingly
useEffect
(()
=>
{
...
...
@@ -88,11 +100,6 @@ const AITimeline = () => {
return
new
Date
(
currentDateGroup
.
date
).
getFullYear
()
!==
new
Date
(
previousDateGroup
.
date
).
getFullYear
();
};
// Calculate the last updated date from the sorted events
const
lastUpdatedDate
=
groupedEventsByDate
.
length
>
0
?
formatLastUpdatedDate
(
groupedEventsByDate
[
0
].
date
)
:
null
;
return
(
<>
<
SEO
...
...
src/data/ai-events.json
View file @
d562dab4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment