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
0c9063d2
Commit
0c9063d2
authored
May 25, 2026
by
Lê Bảo Hồng Đức
☄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
55d771ae
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
42 deletions
+29
-42
page.tsx
src/app/admin/tags/page.tsx
+2
-11
cms-admin.ts
src/lib/api/cms-admin.ts
+2
-11
cms-slug.ts
src/lib/utils/cms-slug.ts
+19
-0
admin-news.ts
src/mockdata/admin-news.ts
+3
-10
header-config.ts
src/mockdata/header-config.ts
+3
-10
No files found.
src/app/admin/tags/page.tsx
View file @
0c9063d2
...
@@ -35,6 +35,7 @@ import {
...
@@ -35,6 +35,7 @@ import {
fetchCmsTagsPage
,
fetchCmsTagsPage
,
updateCmsTag
,
updateCmsTag
,
}
from
"@/lib/api/cms-admin"
;
}
from
"@/lib/api/cms-admin"
;
import
{
toCmsSlug
}
from
"@/lib/utils/cms-slug"
;
interface
TagFormValues
{
interface
TagFormValues
{
id
?:
string
;
id
?:
string
;
...
@@ -52,17 +53,7 @@ const EMPTY_FORM: TagFormValues = {
...
@@ -52,17 +53,7 @@ const EMPTY_FORM: TagFormValues = {
const
fieldClassName
=
const
fieldClassName
=
"rounded-xl border-[#063e8e]/15 bg-white text-gray-700 placeholder:text-gray-700 focus-visible:ring-[#063e8e]/30"
;
"rounded-xl border-[#063e8e]/15 bg-white text-gray-700 placeholder:text-gray-700 focus-visible:ring-[#063e8e]/30"
;
const
slugifyTag
=
(
value
:
string
)
=>
const
slugifyTag
=
(
value
:
string
)
=>
toCmsSlug
(
value
);
value
.
normalize
(
"NFD"
)
.
replace
(
/
[\u
0300-
\u
036f
]
/g
,
""
)
.
replace
(
/đ/g
,
"d"
)
.
replace
(
/Đ/g
,
"D"
)
.
toLowerCase
()
.
trim
()
.
replace
(
/
[^
a-z0-9
\s
-
]
/g
,
""
)
.
replace
(
/
\s
+/g
,
"-"
)
.
replace
(
/-+/g
,
"-"
);
export
default
function
AdminTagsPage
()
{
export
default
function
AdminTagsPage
()
{
const
[
items
,
setItems
]
=
React
.
useState
<
CmsTagItem
[]
>
([]);
const
[
items
,
setItems
]
=
React
.
useState
<
CmsTagItem
[]
>
([]);
...
...
src/lib/api/cms-admin.ts
View file @
0c9063d2
"use client"
;
"use client"
;
import
{
useCustomClient
}
from
"@/api/mutator/custom-client"
;
import
{
useCustomClient
}
from
"@/api/mutator/custom-client"
;
import
{
toCmsSlug
}
from
"@/lib/utils/cms-slug"
;
import
{
resolveUploadUrl
}
from
"@/links"
;
import
{
resolveUploadUrl
}
from
"@/links"
;
import
{
categoryFallbackRows
}
from
"@/mockdata/categories"
;
import
{
categoryFallbackRows
}
from
"@/mockdata/categories"
;
...
@@ -510,17 +511,7 @@ const toCategoryApiType = (type: CmsHeaderCategoryType) => {
...
@@ -510,17 +511,7 @@ const toCategoryApiType = (type: CmsHeaderCategoryType) => {
return
"page"
;
return
"page"
;
};
};
const
toTagSlug
=
(
value
:
string
)
=>
const
toTagSlug
=
(
value
:
string
)
=>
toCmsSlug
(
value
);
value
.
normalize
(
"NFD"
)
.
replace
(
/
[\u
0300-
\u
036f
]
/g
,
""
)
.
replace
(
/đ/g
,
"d"
)
.
replace
(
/Đ/g
,
"D"
)
.
toLowerCase
()
.
trim
()
.
replace
(
/
[^
a-z0-9
\s
-
]
/g
,
""
)
.
replace
(
/
\s
+/g
,
"-"
)
.
replace
(
/-+/g
,
"-"
);
export
async
function
fetchCmsCategories
()
{
export
async
function
fetchCmsCategories
()
{
const
result
=
await
cmsRequest
<
CmsPagedResult
<
CmsCategoryItem
>>
(
const
result
=
await
cmsRequest
<
CmsPagedResult
<
CmsCategoryItem
>>
(
...
...
src/lib/utils/cms-slug.ts
0 → 100644
View file @
0c9063d2
const
VIETNAMESE_D_CHARACTERS
=
/
[
đĐ
]
/g
;
const
DASH_LIKE_CHARACTERS
=
/
[\u
2010-
\u
2015
\u
2212
]
+/g
;
function
replaceVietnameseDCharacter
(
character
:
string
)
{
return
character
===
"Đ"
?
"D"
:
"d"
;
}
export
function
toCmsSlug
(
value
:
string
)
{
return
value
.
trim
()
.
replace
(
DASH_LIKE_CHARACTERS
,
"-"
)
.
replace
(
VIETNAMESE_D_CHARACTERS
,
replaceVietnameseDCharacter
)
.
normalize
(
"NFD"
)
.
replace
(
/
[\u
0300-
\u
036f
]
/g
,
""
)
.
toLowerCase
()
.
replace
(
/
[^
a-z0-9
\s
-
]
/g
,
" "
)
.
replace
(
/
[\s
_-
]
+/g
,
"-"
)
.
replace
(
/^-+|-+$/g
,
""
);
}
src/mockdata/admin-news.ts
View file @
0c9063d2
"use client"
;
"use client"
;
import
{
toCmsSlug
}
from
"@/lib/utils/cms-slug"
;
export
const
ADMIN_NEWS_STORAGE_KEY
=
"vcci-news.admin-news.data.v3"
;
export
const
ADMIN_NEWS_STORAGE_KEY
=
"vcci-news.admin-news.data.v3"
;
export
const
ADMIN_MEDIA_STORAGE_KEY
=
"vcci-news.admin-media-library.data.v1"
;
export
const
ADMIN_MEDIA_STORAGE_KEY
=
"vcci-news.admin-media-library.data.v1"
;
...
@@ -1252,16 +1254,7 @@ const newsSeed: AdminNewsItem[] = [
...
@@ -1252,16 +1254,7 @@ const newsSeed: AdminNewsItem[] = [
];
];
export
function
slugifyAdminNews
(
value
:
string
)
{
export
function
slugifyAdminNews
(
value
:
string
)
{
return
value
return
toCmsSlug
(
value
);
.
normalize
(
"NFD"
)
.
replace
(
/
[\u
0300-
\u
036f
]
/g
,
""
)
.
replace
(
/d/g
,
"d"
)
.
replace
(
/�/g
,
"D"
)
.
toLowerCase
()
.
trim
()
.
replace
(
/
[^
a-z0-9
\s
-
]
/g
,
""
)
.
replace
(
/
\s
+/g
,
"-"
)
.
replace
(
/-+/g
,
"-"
);
}
}
export
function
resolveAdminNewsType
(
value
?:
string
|
null
):
AdminNewsType
|
undefined
{
export
function
resolveAdminNewsType
(
value
?:
string
|
null
):
AdminNewsType
|
undefined
{
...
...
src/mockdata/header-config.ts
View file @
0c9063d2
"use client"
;
"use client"
;
import
{
toCmsSlug
}
from
"@/lib/utils/cms-slug"
;
export
type
HeaderCategoryType
=
"category"
|
"page"
|
"news"
;
export
type
HeaderCategoryType
=
"category"
|
"page"
|
"news"
;
export
interface
HeaderCategoryItem
{
export
interface
HeaderCategoryItem
{
...
@@ -194,16 +196,7 @@ export const headerArticleCategoryOptions: HeaderArticleCategoryOption[] = [
...
@@ -194,16 +196,7 @@ export const headerArticleCategoryOptions: HeaderArticleCategoryOption[] = [
];
];
export
function
toSlug
(
value
:
string
)
{
export
function
toSlug
(
value
:
string
)
{
return
value
return
toCmsSlug
(
value
);
.
normalize
(
"NFD"
)
.
replace
(
/
[\u
0300-
\u
036f
]
/g
,
""
)
.
replace
(
/đ/g
,
"d"
)
.
replace
(
/Đ/g
,
"D"
)
.
toLowerCase
()
.
trim
()
.
replace
(
/
[^
a-z0-9
\s
-
]
/g
,
""
)
.
replace
(
/
\s
+/g
,
"-"
)
.
replace
(
/-+/g
,
"-"
);
}
}
function
normalizeTagsearchValues
(
values
?:
string
[])
{
function
normalizeTagsearchValues
(
values
?:
string
[])
{
...
...
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