fix search fallback icon [skip ci]

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier
2022-06-08 12:32:27 +02:00
parent 233d31c8b0
commit 34b07d64fd
3 changed files with 14 additions and 9 deletions

9
css/cospend-search.css Normal file
View File

@@ -0,0 +1,9 @@
.icon-cospend-search-fallback {
background-image: url(./../img/app_black.svg);
filter: var(--background-invert-if-dark);
}
/* for NC <= 24 */
body.theme--dark .icon-cospend-search-fallback {
background-image: url(./../img/app.svg);
}

View File

@@ -20,6 +20,7 @@ use OCP\Notification\IManager as INotificationManager;
use OCA\Cospend\Search\CospendSearchProvider;
use OCA\Cospend\Dashboard\CospendWidget;
use OCA\Cospend\Notification\Notifier;
use OCP\Util;
/**
* Class Application
@@ -91,7 +92,7 @@ class Application extends App implements IBootstrap {
}
public function boot(IBootContext $context): void {
Util::addStyle(self::APP_ID, 'cospend-search');
}
}

View File

@@ -124,11 +124,6 @@ class CospendSearchProvider implements IProvider {
$offset = $query->getCursor();
$offset = $offset ? (int) $offset : 0;
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme');
$thumbnailUrl = ($theme === 'dark') ?
$this->urlGenerator->imagePath('cospend', 'app.svg') :
$this->urlGenerator->imagePath('cospend', 'app_black.svg');
$resultBills = [];
// get user's projects
@@ -154,15 +149,15 @@ class CospendSearchProvider implements IProvider {
$resultBills = array_slice($resultBills, $offset, $limit);
// build formatted
$formattedResults = array_map(function (array $bill) use ($projectsById, $thumbnailUrl):CospendSearchResultEntry {
$formattedResults = array_map(function (array $bill) use ($projectsById):CospendSearchResultEntry {
$projectId = $bill['projectId'];
// $projectName = $projectsById[$projectId]['name'];
return new CospendSearchResultEntry(
$thumbnailUrl,
'',
$this->getMainText($bill, $projectsById[$projectId]),
$this->getSubline($bill, $projectsById[$projectId]),
$this->getDeepLinkToCospendApp($projectId, $bill['id']),
'',
'icon-cospend-search-fallback',
false
);
}, $resultBills);