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

feature: added new FavouriteWidget to display favorite files in dashboard widget #49534

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yemkareems
Copy link
Contributor

feature: added new FavouriteWidget to display favorite files in dashboard widget

added a new widget to display favorite files in dashboard and to show a link to more favorites to apps/files/favorites. if max count of favorites of 50 is reached then also 'No favorites' is displayed

image

fixes: #23308

  • Resolves: #

Summary

TODO

  • ...

Checklist

@yemkareems yemkareems added the 3. to review Waiting for reviews label Nov 28, 2024
@yemkareems yemkareems self-assigned this Nov 28, 2024
…d widget

Signed-off-by: yemkareems <yemkareems@gmail.com>
@yemkareems yemkareems force-pushed the feature/23308/create-new-favorite-dashboard-widget branch from 09e1e7c to 341e377 Compare November 28, 2024 07:18
apps/files/composer/composer/autoload_static.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
apps/files/lib/Dashboard/FavouriteWidget.php Outdated Show resolved Hide resolved
@AndyScherzinger
Copy link
Member

Looping in @jancborchardt for

if max count of favorites of 50 is reached then also 'No favorites' is displayed

This seems unintuitive since "no favorites" implies count==0 but it is actually count>=50. So I would expect something like "too many favorites to display" or show the 50 and a "more" element/button.

Or I misunderstand the description @yemkareems 😄

@skjnldsv
Copy link
Member

Following Andy's comment, I would actually say we show the last xx updated favorites (like 20 🤷 )

@sorbaugh
Copy link
Contributor

sorbaugh commented Dec 2, 2024

Following Andy's comment, I would actually say we show the last xx updated favorites (like 20 🤷 )

I agree that this would be a good approach. cc @jancborchardt

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

Following Andy's comment, I would actually say we show the last xx updated favorites (like 20 🤷 )

Sounds good to me as well!

Also 2 smaller things:

  • The title should be "Favorite files" so it's clearer what it is. (Just like we say "Recommended files")
  • The icon can be a favorite star to show a little difference

@sorbaugh
Copy link
Contributor

sorbaugh commented Dec 2, 2024

Following Andy's comment, I would actually say we show the last xx updated favorites (like 20 🤷 )

Sounds good to me as well!

Also 2 smaller things:

  • The title should be "Favorite files" so it's clearer what it is. (Just like we say "Recommended files")
  • The icon can be a favorite star to show a little difference

cc @yemkareems

…unwanted IWidget and usersession, renamed id, renamed class to FavoriteWidget, removed limit logic

Signed-off-by: yemkareems <yemkareems@gmail.com>
Signed-off-by: yemkareems <yemkareems@gmail.com>
@yemkareems
Copy link
Contributor Author

Looping in @jancborchardt for

if max count of favorites of 50 is reached then also 'No favorites' is displayed

This seems unintuitive since "no favorites" implies count==0 but it is actually count>=50. So I would expect something like "too many favorites to display" or show the 50 and a "more" element/button.

Or I misunderstand the description @yemkareems 😄

Irrespective of the limit the ui is showing only the latest 6. Hence removed the limit logic here and after 6 items, More favorites button is displayed which takes the user to file listing.

@yemkareems
Copy link
Contributor Author

Following Andy's comment, I would actually say we show the last xx updated favorites (like 20 🤷 )

Sounds good to me as well!

Also 2 smaller things:

  • The title should be "Favorite files" so it's clearer what it is. (Just like we say "Recommended files")
  • The icon can be a favorite star to show a little difference

Changed the title and icon. The icon star loads with a grey color color initially and then it changes to black. The SVG is black however.

@yemkareems
Copy link
Contributor Author

Initial icon load

image

After a while

image

@AndyScherzinger
Copy link
Member

I think @nickvergessen fixed this a while ago for all icons until then, maybe you remember the PR @nickvergessen ?

@AndyScherzinger
Copy link
Member

AndyScherzinger commented Dec 2, 2024

@yemkareems I would remove the circular masking, we don't have it in the files interface nor any other list in the dashboard except for avatars - see for reference in your screenshots: recommended files

@jancborchardt
Copy link
Member

@yemkareems I would remove the circular masking, we don't have it in the files interface nor any other list in the dashboard except for avatars - see for reference in your screenshots: recommended files

Yep agree, missed this somehow. Circular masking is only for avatars. File previews get a little border-radius and filetype icons should be displayed as is.

}

public function getUrl(): ?string {
return $this->urlGenerator->getAbsoluteURL('index.php/apps/files/favorites');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return $this->urlGenerator->getAbsoluteURL('index.php/apps/files/favorites');
return $this->urlGenerator->linkToRouteAbsolute('files.View.indexView', ['view' => 'favorites']);

$node = $userFolder->getFirstNodeById($favorite);
if ($node) {
$url = $this->urlGenerator->linkToRouteAbsolute(
'files.viewcontroller.showFile', ['fileid' => $node->getId()]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'files.viewcontroller.showFile', ['fileid' => $node->getId()]
'files.view.showFile', ['fileid' => $node->getId()]

return [
new WidgetButton(
WidgetButton::TYPE_MORE,
$this->urlGenerator->getAbsoluteURL('index.php/apps/files/favorites'),
Copy link
Member

Choose a reason for hiding this comment

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

same here as above

@@ -10,5 +10,6 @@
'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'),
Copy link
Member

Choose a reason for hiding this comment

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

composer i --no-dev and re-commit

return;
}

public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is $limit applied?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Favourites files to dashboard
7 participants