Skip to content

Feature/vitorlas kupa map#1037

Merged
SzBeni2003 merged 5 commits into
stagingfrom
feature/vitorlas-kupa-map
Jun 5, 2026
Merged

Feature/vitorlas kupa map#1037
SzBeni2003 merged 5 commits into
stagingfrom
feature/vitorlas-kupa-map

Conversation

@peterlipt
Copy link
Copy Markdown
Member

@peterlipt peterlipt commented Jun 4, 2026

Summary by CodeRabbit

  • New Features

    • Fullscreen mode for the map with a close button
    • KirDev branding overlay linking to external site
  • Improvements

    • Better map centering using available location markers
    • More flexible map sizing and styling via added props
  • Bug Fixes

    • More accurate location/user data handling and group membership resolution
    • User-linked location IDs and refreshed user metadata on cached locations

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8c737d7d-3e56-4c71-9132-887d99159c03

📥 Commits

Reviewing files that changed from the base of the PR and between db2137d and 89ec556.

📒 Files selected for processing (3)
  • backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt
  • frontend/src/common-components/map/MapContent.tsx
  • frontend/src/pages/map/map.page.tsx

📝 Walkthrough

Walkthrough

Backend fixes LocationEntity id and userId handling and changes group membership filtering to load and compare user.group ids. Frontend: MapContent gains optional className and height, computes a memoized markers center, and MapPage adds fullscreen state, controls, and a fixed full-viewport mode passing dynamic height to MapContent.

Changes

Location Service ID and Map UI System

Layer / File(s) Summary
Location Entity ID Initialization and Group Membership
backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt
pushLocation initializes LocationEntity.id from userEntity.id; refresh() updates LocationEntity.id and userId from the latest user record and refreshes userName/alias/groupName; findLocationsOfGroup() loads users for cached locations and filters where user.group?.id == groupId.
MapContent Props and Center Calculation
frontend/src/common-components/map/MapContent.tsx
MapContent signature extended with optional className and height (default 400); computes memoized markersCenter from mapData as fallback center; wraps the map in a div with className, passes height to Map, and renders the user-location marker only when showUserLocation and coords are present.
MapPage Fullscreen Mode and Controls
frontend/src/pages/map/map.page.tsx
Adds fullScreen and fullscreenHeight state, derives devWebsiteUrl from config, syncs fullscreenHeight with window.innerHeight, renders control row with show-location and fullscreen toggles; fullscreen mode wraps MapContent in a fixed full-viewport container with close button and KirDev logo overlay and passes dynamic height and className to MapContent.

Sequence Diagram(s)

sequenceDiagram
  participant ComponentA
  participant ComponentB
  ComponentA->>ComponentB: observable interaction
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped to fix each stray ID,
The map grew tall, then shone with glee,
Centers found where markers lie,
Fullscreen opens wide and free,
KirDev winks — a rabbit's sigh.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feature/vitorlas kupa map' is vague and does not clearly describe the specific changes made, using a feature branch naming convention rather than a descriptive summary. Use a more descriptive title that summarizes the main changes, such as 'Add fullscreen map mode with dynamic sizing and group-based location filtering' or 'Improve map component with fullscreen capability and location service refactoring'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/vitorlas-kupa-map

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the map experience by adding a fullscreen display mode in the frontend, improving map centering logic based on available markers, and adjusting backend location entity identification/group filtering for tracking-related endpoints.

Changes:

  • Add a fullscreen toggle on the map page with an overlay UI (close button + Kir-Dev logo link).
  • Enhance MapContent to support custom className/height and center the map based on marker averages (or user location when enabled).
  • Update backend LocationService to set LocationEntity.id based on the user and change group filtering logic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
frontend/src/pages/map/map.page.tsx Adds fullscreen UI/overlay around the map and passes sizing/styling props down to MapContent.
frontend/src/common-components/map/MapContent.tsx Adds optional sizing/styling props and changes map centering + user marker display behavior.
backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt Adjusts location entity IDs and changes “locations by group” filtering logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +41
<Checkbox id="full-screen" checked={fullScreen} onCheckedChange={(checked) => setFullScreen(!!checked)} />
<Label htmlFor="full-screen" className="cursor-pointer">
{'Teljes képernyő'}
</Label>
Comment on lines +47 to +52
<button
onClick={() => setFullScreen(false)}
className="absolute top-4 right-4 z-50 bg-black/50 hover:bg-black/70 text-white p-2 rounded-full shadow-lg transition-colors"
aria-label="Bezárás"
>
<X size={24} />
Comment on lines 14 to +16
export default function MapPage() {
const [showUserLocation, setShowUserLocation] = useState(false)
const [fullScreen, setFullScreen] = useState(false)
Comment on lines +66 to +71
<MapContent
mapData={locationQuery.data ?? []}
showUserLocation={showUserLocation}
className={fullScreen ? 'h-screen w-screen' : ''}
height={fullScreen ? (typeof window !== 'undefined' ? window.innerHeight : 800) : 400}
/>
Comment on lines 128 to +132
fun findLocationsOfGroup(groupId: Int): List<LocationEntity> {
return tokenToLocationMapping.values.filter { it.id == groupId }
return tokenToLocationMapping.values.filter {
val user = userRepository.findById(it.userId)
user.isPresent && user.get().group?.id == groupId
}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt`:
- Around line 129-132: The current findLocationsOfGroup implementation iterates
tokenToLocationMapping.values and calls userRepository.findById per element,
causing N+1 queries and risking LazyInitializationException when accessing
user.group; fix by avoiding per-location DB fetch: either persist groupId on
LocationEntity during pushLocation/refresh and then filter
tokenToLocationMapping.values by location.groupId == groupId, or batch-fetch
users once inside a transaction (use transactionManager.transaction and
userRepository.findAllById with the collected userIds) to build a set of user
IDs in the group and then filter locations by userId in that set; update
findLocationsOfGroup accordingly and ensure pushLocation/refresh populate
location.groupId if choosing the first approach.

In `@frontend/src/common-components/map/MapContent.tsx`:
- Line 53: The Marker elements use mapDataItem.displayName as the React key
which can collide; update the key to a stable unique value (e.g., combine
latitude and longitude and displayName or add and use a dedicated id on
MapDataItemView) so markers reconcile correctly — change the Marker key in
MapContent (where Marker and mapDataItem are used) to something like
`${mapDataItem.latitude}-${mapDataItem.longitude}-${mapDataItem.displayName}` or
use mapDataItem.id if you add one to the data model.

In `@frontend/src/pages/map/map.page.tsx`:
- Line 70: The render reads window.innerHeight directly for the height prop when
fullScreen is true, which becomes stale on resize; introduce a piece of state
(e.g. fullscreenHeight via useState) initialized to window.innerHeight (with
safe typeof window guard) and replace the inline window.innerHeight usage with
that state; add a useEffect that registers a window 'resize' listener to update
fullscreenHeight on resize/orientation change and cleans up the listener on
unmount; ensure the height prop uses fullscreenHeight when fullScreen is true
and falls back to 400 otherwise.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bc4e0e7-acab-4795-9631-98c3f72a5597

📥 Commits

Reviewing files that changed from the base of the PR and between d8d7ec1 and db2137d.

📒 Files selected for processing (3)
  • backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt
  • frontend/src/common-components/map/MapContent.tsx
  • frontend/src/pages/map/map.page.tsx

Comment thread backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt Outdated
Comment thread frontend/src/common-components/map/MapContent.tsx Outdated
Comment thread frontend/src/pages/map/map.page.tsx Outdated
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmsch-cst Ready Ready Preview, Comment Jun 5, 2026 9:22am
cmsch-felezobal Ready Ready Preview, Comment Jun 5, 2026 9:22am
cmsch-golyakorte Ready Ready Preview, Comment Jun 5, 2026 9:22am
cmsch-skktv Ready Ready Preview, Comment Jun 5, 2026 9:22am
cmsch-snyt Ready Ready Preview, Comment Jun 5, 2026 9:22am
cmsch-vitorlaskupa Ready Ready Preview, Comment Jun 5, 2026 9:22am

Request Review

Copy link
Copy Markdown
Contributor

@SzBeni2003 SzBeni2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants