Skip to content

Commit

Permalink
fix: ui fixes to remove rounded corners and make the ui/ux similar to…
Browse files Browse the repository at this point in the history
… recommendation widget. cs fix. composer fix no dev and review comments from Joas and Côme addressed

Signed-off-by: yemkareems <[email protected]>
  • Loading branch information
yemkareems committed Dec 4, 2024
1 parent 7ad8f46 commit c6fdaca
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 30 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/src/DashboardApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{ t('dashboard', '"{title} icon"', { title: apiWidgets[panels[panelId].id].title }) }}
</span>
</div>
<div class="panel--content">
<div class="panel--content" :id="`panel-${panels[panelId].id}`">
<ApiDashboardWidget :widget="apiWidgets[panels[panelId].id]"
:data="apiWidgetItems[panels[panelId].id]"
:loading="loadingItems" />
Expand Down
38 changes: 38 additions & 0 deletions apps/files/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#panel-files-favorites {
.avatardiv {
border-radius: var(--border-radius);
flex-shrink: 0;

& > img {
border-radius: var(--border-radius);
flex-shrink: 0;
margin-right: 9px;
}

background: none !important;
margin-left: 8px;
margin-right: 9px;
}
.item-list__entry {
padding-left: 0;
padding-right: 0;
}
.item__details {
white-space: nowrap;
margin-bottom: -8px;
display: inline-block;
max-width: 170px;
color: var(--color-main-text);
text-overflow: ellipsis;
overflow: hidden;
padding-left: 0;
border-radius: var(--border-radius);
}
h3 {
font-weight: 400;
}
}
29 changes: 15 additions & 14 deletions apps/files/lib/Dashboard/FavoriteWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@
use OCP\ITagManager;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Util;

class FavoriteWidget implements IIconWidget, IAPIWidgetV2, IButtonWidget {
public function __construct(
private readonly IL10N $l10n,
private readonly IURLGenerator $urlGenerator,
private readonly IL10N $l10n,
private readonly IURLGenerator $urlGenerator,
private readonly IMimeTypeDetector $mimeTypeDetector,
private readonly IUserManager $userManager,
private readonly ITagManager $tagManager,
private readonly IRootFolder $rootFolder,
private readonly IPreview $previewManager,
private readonly IUserManager $userManager,
private readonly ITagManager $tagManager,
private readonly IRootFolder $rootFolder,
private readonly IPreview $previewManager,
) {

}

public function getId(): string {
return Application::APP_ID.'-favorites';
return Application::APP_ID . '-favorites';
}

public function getTitle(): string {
Expand All @@ -60,14 +61,14 @@ public function getIconUrl(): string {
}

public function getUrl(): ?string {
return $this->urlGenerator->getAbsoluteURL('index.php/apps/files/favorites');
return $this->urlGenerator->linkToRouteAbsolute('files.View.indexView', ['view' => 'favorites']);
}

public function load(): void {
return;
Util::addStyle('files', 'style');
}

public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
public function getItems(string $userId, int $limit = 7): array {
$user = $this->userManager->get($userId);

if (!$user) {
Expand All @@ -84,7 +85,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
$node = $userFolder->getFirstNodeById($favorite);
if ($node) {
$url = $this->urlGenerator->linkToRouteAbsolute(
'files.viewcontroller.showFile', ['fileid' => $node->getId()]
'files.view.showFile', ['fileid' => $node->getId()]
);
if ($this->previewManager->isAvailable($node)) {
$icon = $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', [
Expand All @@ -108,11 +109,11 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
}
}

return $favoriteNodes;
return array_slice($favoriteNodes, 0, $limit);
}

public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems {
$items = $this->getItems($userId, $since, $limit);
$items = $this->getItems($userId, $limit);
return new WidgetItems(
$items,
count($items) === 0 ? $this->l10n->t('No favorites') : '',
Expand All @@ -123,7 +124,7 @@ public function getWidgetButtons(string $userId): array {
return [
new WidgetButton(
WidgetButton::TYPE_MORE,
$this->urlGenerator->getAbsoluteURL('index.php/apps/files/favorites'),
$this->urlGenerator->linkToRouteAbsolute('files.View.indexView', ['view' => 'favorites']),
$this->l10n->t('More favorites')
),
];
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dashboard-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dashboard-main.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion lib/composer/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
'OC\\' => array($baseDir . '/lib/private'),
'OCP\\' => array($baseDir . '/lib/public'),
'NCU\\' => array($baseDir . '/lib/unstable'),
'Bamarni\\Composer\\Bin\\' => array($vendorDir . '/bamarni/composer-bin-plugin/src'),
'' => array($baseDir . '/lib/private/legacy'),
);
8 changes: 0 additions & 8 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
array (
'NCU\\' => 4,
),
'B' =>
array (
'Bamarni\\Composer\\Bin\\' => 21,
),
);

public static $prefixDirsPsr4 = array (
Expand All @@ -44,10 +40,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
array (
0 => __DIR__ . '/../../..' . '/lib/unstable',
),
'Bamarni\\Composer\\Bin\\' =>
array (
0 => __DIR__ . '/..' . '/bamarni/composer-bin-plugin/src',
),
);

public static $fallbackDirsPsr4 = array (
Expand Down

0 comments on commit c6fdaca

Please sign in to comment.