Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finwise-miniapp-fe
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
ThinhNC
finwise-miniapp-fe
Commits
01f97f3f
Commit
01f97f3f
authored
Oct 15, 2026
by
ThinhNC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove custom ZMPRouter file
parent
8068b030
Pipeline
#53712
passed with stage
in 32 seconds
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
80 deletions
+0
-80
ZMPRouter.tsx
src/components/router/ZMPRouter.tsx
+0
-80
No files found.
src/components/router/ZMPRouter.tsx
deleted
100644 → 0
View file @
8068b030
import
React
,
{
useCallback
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
BrowserRouter
,
MemoryRouter
}
from
"react-router-dom"
;
export
interface
AnimationRouterContextType
{
animate
:
boolean
;
direction
:
string
;
setAnimate
:
(
config
:
{
animate
?:
boolean
;
direction
?:
string
})
=>
void
;
pageScrollPosition
:
Record
<
string
,
number
>
;
updatePosition
:
(
key
:
string
,
position
:
number
)
=>
void
;
}
export
const
AnimationRouterContext
=
React
.
createContext
<
AnimationRouterContextType
|
undefined
>
(
undefined
);
export
interface
ZMPRouterProps
{
children
?:
React
.
ReactNode
;
memoryRouter
?:
boolean
;
}
const
PAGE_TRANSITION_FORWARD
=
"forward"
;
const
PAGE_TRANSITION_BACKWARD
=
"backward"
;
export
const
ZMPRouter
:
React
.
FC
<
ZMPRouterProps
>
=
(
props
)
=>
{
const
[
animate
,
setAnimate
]
=
useState
(
true
);
const
[
direction
,
setDirection
]
=
useState
(
PAGE_TRANSITION_FORWARD
);
const
pageScrollPosition
=
useRef
<
Record
<
string
,
number
>>
({});
const
{
children
,
memoryRouter
}
=
props
;
// Determine basepath safely:
// Inside Zalo webview, the path begins with `/zapps/<APP_ID>`.
// On Vercel / standalone web, use "" so all standard routes (/, /login, etc.) match.
const
win
=
typeof
window
!==
"undefined"
?
(
window
as
unknown
as
Record
<
string
,
unknown
>
)
:
null
;
let
basepath
=
(
win
?.
BASE_PATH
as
string
)
||
""
;
const
pathname
=
typeof
window
!==
"undefined"
?
window
.
location
.
pathname
:
""
;
const
appId
=
(
win
?.
APP_ID
as
string
)
||
""
;
if
(
pathname
.
startsWith
(
"/zapps/"
)
&&
appId
)
{
basepath
=
`/zapps/
${
appId
}
`
;
}
else
if
(
!
basepath
)
{
basepath
=
""
;
}
const
handleSetAnimate
=
useCallback
(
({
animate
:
ani
=
true
,
direction
:
dir
=
PAGE_TRANSITION_FORWARD
}:
{
animate
?:
boolean
;
direction
?:
string
})
=>
{
setAnimate
(
Boolean
(
ani
));
const
correctDirection
=
[
PAGE_TRANSITION_FORWARD
,
PAGE_TRANSITION_BACKWARD
].
includes
(
dir
)
?
dir
:
PAGE_TRANSITION_FORWARD
;
setDirection
(
correctDirection
);
},
[]
);
const
updateScrollPosition
=
(
key
:
string
,
position
:
number
)
=>
{
pageScrollPosition
.
current
[
key
]
=
position
;
};
const
contextValue
=
useMemo
(
()
=>
({
setAnimate
:
handleSetAnimate
,
animate
,
direction
,
pageScrollPosition
:
pageScrollPosition
.
current
,
updatePosition
:
updateScrollPosition
,
}),
[
animate
,
direction
,
handleSetAnimate
]
);
const
RouterComponent
=
memoryRouter
?
MemoryRouter
:
BrowserRouter
;
const
routerProps
=
memoryRouter
?
{
initialEntries
:
[
basepath
||
"/"
]
}
:
{};
return
(
<
AnimationRouterContext
.
Provider
value=
{
contextValue
}
>
<
RouterComponent
basename=
{
basepath
}
{
...
routerProps
}
>
{
children
}
</
RouterComponent
>
</
AnimationRouterContext
.
Provider
>
);
};
export
default
ZMPRouter
;
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