Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Triptag
Frontend
Commits
5a91a39a
Commit
5a91a39a
authored
9 months ago
by
Anna Ivanytska
Browse files
Options
Downloads
Patches
Plain Diff
LimitNumbers (DONE)
parent
ca3859d7
Branches
24-limit-numers-in-recommendationpage
LimitNumers
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pages/RecommendationPage.tsx
+10
-4
10 additions, 4 deletions
src/pages/RecommendationPage.tsx
with
10 additions
and
4 deletions
src/pages/RecommendationPage.tsx
+
10
−
4
View file @
5a91a39a
...
...
@@ -35,10 +35,9 @@ const RecommendationPage: React.FC = () => {
const
[
buttonClicked
,
setButtonClicked
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
recommendations
,
setRecommendations
]
=
useState
<
UserRecommendation
[]
>
([]);
const
[
userId
,
setUserId
]
=
useState
(
""
);
// Dodaj stan dla user_id
const
[
userId
,
setUserId
]
=
useState
(
""
);
useEffect
(()
=>
{
// Pobierz user_id z localStorage przy pierwszym renderowaniu strony
const
storedUserId
=
localStorage
.
getItem
(
"
user_id
"
);
if
(
storedUserId
)
{
setUserId
(
storedUserId
);
...
...
@@ -100,8 +99,15 @@ const RecommendationPage: React.FC = () => {
key
=
{
index
}
className
=
"flex justify-center"
>
{
/* Przekaż user_id jako props do RecommendationCard */
}
<
RecommendationCard
recommendation
=
{
rec
}
userId
=
{
userId
}
/>
<
RecommendationCard
recommendation
=
{
{
...
rec
,
score
:
parseFloat
(
rec
.
score
.
toFixed
(
2
)),
average_rating
:
parseFloat
(
rec
.
average_rating
.
toFixed
(
2
)),
average_food_rating
:
parseFloat
(
rec
.
average_food_rating
.
toFixed
(
2
)),
}
}
userId
=
{
userId
}
/>
</
Grid
>
))
}
</
Grid
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment