Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plcaes tab - use different colour for the individual's own events #4999

Merged
merged 8 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions app/Module/PlacesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
'INDI:RESI' => ['color' => 'darkcyan', 'name' => 'home fas'],
];

protected const OWN_ICONS = [
'INDI:BIRT' => ['color' => 'red', 'name' => 'baby-carriage fas'],
'INDI:CHR' => ['color' => 'red', 'name' => 'water fas'],
] + self::ICONS;

protected const DEFAULT_ICON = ['color' => 'gold', 'name' => 'bullseye fas'];

private LeafletJsService $leaflet_js_service;
Expand Down Expand Up @@ -145,6 +150,8 @@
$longitude = $location->longitude();
}

$icons = $fact->record() === $indi ? static::OWN_ICONS : static::ICONS;

Check warning on line 153 in app/Module/PlacesModule.php

View check run for this annotation

Codecov / codecov/patch

app/Module/PlacesModule.php#L153

Added line #L153 was not covered by tests

if ($latitude !== null && $longitude !== null) {
$geojson['features'][] = [
'type' => 'Feature',
Expand All @@ -154,7 +161,7 @@
'coordinates' => [$longitude, $latitude],
],
'properties' => [
'icon' => static::ICONS[$fact->tag()] ?? static::DEFAULT_ICON,
'icon' => $icons[$fact->tag()] ?? static::DEFAULT_ICON,

Check warning on line 164 in app/Module/PlacesModule.php

View check run for this annotation

Codecov / codecov/patch

app/Module/PlacesModule.php#L164

Added line #L164 was not covered by tests
'tooltip' => $fact->place()->gedcomName(),
'summary' => view('modules/places/event-sidebar', $this->summaryData($indi, $fact)),
],
Expand Down Expand Up @@ -188,7 +195,9 @@

$facts = Fact::sortFacts($facts);

return $facts->filter(static fn (Fact $item): bool => $item->place()->gedcomName() !== '');
return $facts->filter(static function (Fact $item): bool {
return $item->place()->gedcomName() !== '';
});

Check warning on line 200 in app/Module/PlacesModule.php

View check run for this annotation

Codecov / codecov/patch

app/Module/PlacesModule.php#L198-L200

Added lines #L198 - L200 were not covered by tests
}

/**
Expand Down