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
9f9abbe5
Commit
9f9abbe5
authored
Nov 25, 2025
by
Phạm Quang Bảo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update/change to components nextjs
parent
3d0df67f
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
668 additions
and
616 deletions
+668
-616
next.config.ts
next.config.ts
+7
-1
index.tsx
src/app/(main)/(home)/components/card-event/index.tsx
+8
-8
index.tsx
src/app/(main)/(home)/components/card-news/index.tsx
+8
-8
page.tsx
src/app/(main)/(home)/page.tsx
+577
-599
index.tsx
src/components/base/image/index.tsx
+19
-0
memberImages.ts
src/constants/memberImages.ts
+10
-0
partnerImages.ts
src/constants/partnerImages.ts
+22
-0
stripImageAndHtml.ts
src/helpers/stripImageAndHtml.ts
+17
-0
No files found.
next.config.ts
View file @
9f9abbe5
...
...
@@ -10,6 +10,12 @@ const nextConfig: NextConfig = {
port
:
""
,
pathname
:
"/vcci/images/**"
,
},
{
protocol
:
"https"
,
hostname
:
"vcci-hcm.org.vn"
,
// WordPress / media host
port
:
""
,
pathname
:
"/wp-content/uploads/**"
,
},
],
},
};
...
...
src/app/(main)/(home)/components/card-event/index.tsx
View file @
9f9abbe5
...
...
@@ -2,21 +2,21 @@ import { EventItem } from '@/api/types/event'
import
BASE_URL
from
'@/links'
import
dayjs
from
'dayjs'
;
import
AppEditorContent
from
'@/components/shared/editor-content'
;
import
Link
from
"next/link"
;
import
ImageNext
from
"@/components/base/image"
;
function
CardEvent
({
event
}:
{
event
:
EventItem
})
{
return
(
<
a
<
Link
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'
>
<
img
<
ImageNext
src=
{
`${BASE_URL.imageEndpoint}${event.image}`
}
alt=
{
event
.
name
}
className=
'w-[100px] md:w-[130px] aspect-3/2 object-cover'
onError=
{
(
e
)
=>
{
e
.
currentTarget
.
onerror
=
null
e
.
currentTarget
.
src
=
"/img-error.png"
}
}
className=
'aspect-3/2 object-cover'
width=
{
130
}
height=
{
86
}
/>
<
div
className=
'flex-1'
>
<
p
className=
'text-[#0056b3] font-bold text-sm line-clamp-2'
>
...
...
@@ -27,7 +27,7 @@ function CardEvent({ event }: { event: EventItem }) {
</
p
>
{
/* <AppEditorContent className='line-clamp-2' value={event.description} /> */
}
</
div
>
</
a
>
</
Link
>
);
}
...
...
src/app/(main)/(home)/components/card-news/index.tsx
View file @
9f9abbe5
...
...
@@ -2,21 +2,21 @@ import { NewsItem } from "@/api/types/news";
import
BASE_URL
from
"@/links"
;
import
dayjs
from
"dayjs"
;
import
AppEditorContent
from
"@/components/shared/editor-content"
;
import
Link
from
"next/link"
;
import
ImageNext
from
"@/components/base/image"
;
function
CardNews
({
news
}:
{
news
:
NewsItem
})
{
return
(
<
a
<
Link
href=
{
`${news.external_link}`
}
className=
"flex flex-row gap-2 mb-2 sm:gap-3 sm:mb-3"
>
<
img
<
ImageNext
src=
{
`${BASE_URL.imageEndpoint}${news.thumbnail}`
}
alt=
{
news
.
title
}
className=
"w-[100px] md:w-[130px] aspect-3/2 object-cover"
onError=
{
(
e
)
=>
{
e
.
currentTarget
.
onerror
=
null
e
.
currentTarget
.
src
=
"/img-error.png"
}
}
className=
"aspect-3/2 object-cover"
width=
{
130
}
height=
{
86
}
/>
<
div
className=
"flex-1"
>
<
p
className=
"text-[#363636] font-bold text-sm line-clamp-2"
>
...
...
@@ -27,7 +27,7 @@ function CardNews({ news }: { news: NewsItem }) {
</
p
>
{
/* <AppEditorContent className='line-clamp-2' value={news.description} /> */
}
</
div
>
</
a
>
</
Link
>
);
}
...
...
src/app/(main)/(home)/page.tsx
View file @
9f9abbe5
This diff is collapsed.
Click to expand it.
src/components/base/image/index.tsx
0 → 100644
View file @
9f9abbe5
import
Image
from
"next/image"
;
import
{
useState
}
from
"react"
;
const
ImageNext
=
({
src
,
alt
,
width
,
height
,
className
,
onError
}:
any
)
=>
{
const
[
imgSrc
,
setImgSrc
]
=
useState
(
src
);
return
(
<
Image
src=
{
imgSrc
}
alt=
{
alt
}
width=
{
width
}
height=
{
height
}
className=
{
className
}
onError=
{
()
=>
setImgSrc
(
onError
||
"/img-error.png"
)
}
/>
);
};
export
default
ImageNext
;
src/constants/memberImages.ts
0 → 100644
View file @
9f9abbe5
const
memberImages
=
[
"/home/hoi-vien-tieu-bieu/logo-GTD-768x768.png.webp"
,
"/home/hoi-vien-tieu-bieu/Nhua-Long-Thanh_Logo.jpg.webp"
,
"/home/hoi-vien-tieu-bieu/Nova_Group_logo-1.png.webp"
,
"/home/hoi-vien-tieu-bieu/samngoclinh-1-768x768.png.webp"
,
"/home/hoi-vien-tieu-bieu/Screenshot-2022-12-26-144136-768x768.png.webp"
,
"/home/hoi-vien-tieu-bieu/UOB-logo_Vuong.jpeg.webp"
,
];
export
default
memberImages
;
\ No newline at end of file
src/constants/partnerImages.ts
0 → 100644
View file @
9f9abbe5
const
partnerImages
=
[
"/home/doi-tac/AMFORI-1.png.webp"
,
"/home/doi-tac/AUS4SKILLS-1.png.webp"
,
"/home/doi-tac/BetterWork-1.png.webp"
,
"/home/doi-tac/BOI-LOGO.jpg.webp"
,
"/home/doi-tac/DNV-logo-1-1.png.webp"
,
"/home/doi-tac/GERMAN-COOPERATION-1.png.webp"
,
"/home/doi-tac/GIZ.png.webp"
,
"/home/doi-tac/HBA.png.webp"
,
"/home/doi-tac/ILO-1.png.webp"
,
"/home/doi-tac/InvestHK.png.webp"
,
"/home/doi-tac/IOM-1.png.webp"
,
"/home/doi-tac/JICA-134x100-1-1.jpg.webp"
,
"/home/doi-tac/KIRBY.png.webp"
,
"/home/doi-tac/NHO-1.png.webp"
,
"/home/doi-tac/OXFAM-1.png.webp"
,
"/home/doi-tac/RECOTVET-1.png.webp"
,
"/home/doi-tac/SC-1.png.webp"
,
"/home/doi-tac/UNDP.png.webp"
,
];
export
default
partnerImages
;
\ No newline at end of file
src/helpers/stripImageAndHtml.ts
0 → 100644
View file @
9f9abbe5
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
,
''
)
}
export
default
stripImagesAndHtml
\ No newline at end of file
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