Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VCCI-News
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
Văn Hoàng
VCCI-News
Commits
21563945
Commit
21563945
authored
Nov 06, 2025
by
Phạm Quang Bảo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix/url description
parent
6af58bbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
index.tsx
src/app/(main)/(home)/components/card-event/index.tsx
+1
-1
page.tsx
src/app/(main)/(home)/page.tsx
+23
-12
No files found.
src/app/(main)/(home)/components/card-event/index.tsx
View file @
21563945
...
@@ -6,7 +6,7 @@ import AppEditorContent from '@/components/shared/editor-content';
...
@@ -6,7 +6,7 @@ import AppEditorContent from '@/components/shared/editor-content';
function
CardEvent
({
event
}:
{
event
:
EventItem
})
{
function
CardEvent
({
event
}:
{
event
:
EventItem
})
{
return
(
return
(
<
a
<
a
href=
{
`${event.id}`
}
href=
{
`
hoat-dong/su-kien/
${event.id}`
}
className=
'flex flex-row gap-2 mb-2 sm:gap-3 sm:mb-3 p-2 sm:p-3 border border-gray-200 bg-white rounded-md'
className=
'flex flex-row gap-2 mb-2 sm:gap-3 sm:mb-3 p-2 sm:p-3 border border-gray-200 bg-white rounded-md'
>
>
<
img
<
img
...
...
src/app/(main)/(home)/page.tsx
View file @
21563945
...
@@ -30,6 +30,23 @@ const Page = () => {
...
@@ -30,6 +30,23 @@ const Page = () => {
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
0
);
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
0
);
const
swiperRef
=
useRef
<
SwiperType
|
null
>
(
null
);
const
swiperRef
=
useRef
<
SwiperType
|
null
>
(
null
);
// helpers
const
stripImagesAndHtml
=
(
html
?:
string
)
=>
{
if
(
!
html
)
return
''
// remove img tags first
const
withoutImgs
=
html
.
replace
(
/<img
[^
>
]
*>/gi
,
''
)
// use DOMParser on client for robust extraction
if
(
typeof
window
!==
'undefined'
&&
typeof
DOMParser
!==
'undefined'
)
{
try
{
const
doc
=
new
DOMParser
().
parseFromString
(
withoutImgs
,
'text/html'
)
return
doc
.
body
.
textContent
||
''
}
catch
{
// fallback to regex
}
}
return
withoutImgs
.
replace
(
/<
[^
>
]
*>/g
,
''
)
}
const
{
data
:
categoryData
,
isLoading
:
isLoadingCategory
}
=
useGetCategory
<
GetCategoryAdminResponseType
>
();
const
{
data
:
categoryData
,
isLoading
:
isLoadingCategory
}
=
useGetCategory
<
GetCategoryAdminResponseType
>
();
const
{
data
:
newsData
,
isLoading
:
isLoadingNews
}
=
useGetNews
<
GetNewsAdminResponseType
>
(
const
{
data
:
newsData
,
isLoading
:
isLoadingNews
}
=
useGetNews
<
GetNewsAdminResponseType
>
(
{
{
...
@@ -37,7 +54,7 @@ const Page = () => {
...
@@ -37,7 +54,7 @@ const Page = () => {
filters
:
tab
===
"all"
?
``
:
`category @=
${
tab
}
`
,
filters
:
tab
===
"all"
?
``
:
`category @=
${
tab
}
`
,
}
}
);
);
const
{
data
:
news
Slider
,
isLoading
:
isLoadingNewsSlider
}
=
useGetNews
<
GetNewsAdminResponseType
>
(
const
{
data
:
news
All
,
isLoading
:
isLoadingNewsAll
}
=
useGetNews
<
GetNewsAdminResponseType
>
(
{
{
pageSize
:
'10'
,
pageSize
:
'10'
,
}
}
...
@@ -146,7 +163,7 @@ const Page = () => {
...
@@ -146,7 +163,7 @@ const Page = () => {
}
}
}
}
className=
"pb-5"
className=
"pb-5"
>
>
{
news
Slider
?.
responseData
?.
rows
.
map
((
news
)
=>
(
{
news
All
?.
responseData
?.
rows
.
map
((
news
)
=>
(
<
SwiperSlide
key=
{
news
.
id
}
>
<
SwiperSlide
key=
{
news
.
id
}
>
<
a
<
a
href=
{
`/${news.id}`
}
href=
{
`/${news.id}`
}
...
@@ -195,7 +212,7 @@ const Page = () => {
...
@@ -195,7 +212,7 @@ const Page = () => {
<
hr
className=
"border-[#063e8e] mb-4"
/>
<
hr
className=
"border-[#063e8e] mb-4"
/>
<
div
className=
"flex flex-col md:flex-row gap-5"
>
<
div
className=
"flex flex-col md:flex-row gap-5"
>
{
news
Data
?.
responseData
.
rows
{
news
All
?.
responseData
.
rows
.
slice
(
0
,
1
)
.
slice
(
0
,
1
)
.
map
((
news
:
NewsAdminItem
)
=>
(
.
map
((
news
:
NewsAdminItem
)
=>
(
<
a
<
a
...
@@ -218,10 +235,7 @@ const Page = () => {
...
@@ -218,10 +235,7 @@ const Page = () => {
<
p
className=
"text-gray-500 text-sm"
>
<
p
className=
"text-gray-500 text-sm"
>
{
dayjs
(
news
.
release_at
).
format
(
"DD/MM/YYYY"
)
}
{
dayjs
(
news
.
release_at
).
format
(
"DD/MM/YYYY"
)
}
</
p
>
</
p
>
<
AppEditorContent
<
p
className=
"line-clamp-4"
>
{
stripImagesAndHtml
(
news
.
description
)
}
</
p
>
className=
"line-clamp-4"
value=
{
news
.
description
}
/>
</
div
>
</
div
>
</
a
>
</
a
>
))
}
))
}
...
@@ -326,7 +340,7 @@ const Page = () => {
...
@@ -326,7 +340,7 @@ const Page = () => {
.
map
((
event
:
EventItem
)
=>
(
.
map
((
event
:
EventItem
)
=>
(
<
a
<
a
key=
{
event
.
id
}
key=
{
event
.
id
}
href=
{
`${event.id}`
}
href=
{
`
hoat-dong/su-kien/
${event.id}`
}
className=
"flex flex-col w-full md:w-1/2 min-h-[180px] sm:min-h-[220px] gap-3 mb-3 border border-gray-200 bg-white rounded-md p-3"
className=
"flex flex-col w-full md:w-1/2 min-h-[180px] sm:min-h-[220px] gap-3 mb-3 border border-gray-200 bg-white rounded-md p-3"
>
>
<
div
className=
"w-full aspect-3/2 overflow-hidden"
>
<
div
className=
"w-full aspect-3/2 overflow-hidden"
>
...
@@ -348,10 +362,7 @@ const Page = () => {
...
@@ -348,10 +362,7 @@ const Page = () => {
<
p
className=
"text-gray-500 text-sm my-1"
>
<
p
className=
"text-gray-500 text-sm my-1"
>
{
dayjs
(
event
.
start_time
).
format
(
"DD/MM/YYYY"
)
}
{
dayjs
(
event
.
start_time
).
format
(
"DD/MM/YYYY"
)
}
</
p
>
</
p
>
<
AppEditorContent
<
p
className=
"line-clamp-3"
>
{
stripImagesAndHtml
(
event
.
description
)
}
</
p
>
className=
"line-clamp-3"
value=
{
event
.
description
}
/>
</
div
>
</
div
>
</
a
>
</
a
>
))
}
))
}
...
...
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