Skip to content

feat: platform self-adaptation for file viewer application #276

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

Merged
merged 4 commits into from
Jul 3, 2025

Conversation

Samler-Lee
Copy link
Contributor

{((expanded ? Object.values(ViewersByID) : selectorState?.viewers) ?? emptyViewer)
.filter((viewer) => {
const platform = viewer.platform || "all";
return platform === "all" || platform === (isMobile ? "mobile" : "pc");
Copy link
Member

Choose a reason for hiding this comment

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

Those filtered viewers are not excluded in https://github.com/cloudreve/frontend/blob/master/src/component/FileManager/ContextMenu/OpenWithMenuItems.tsx

Maybe you can do the filtering here:

config.file_viewers?.forEach((group) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isMobile based to useMediaQuery, it seems not suitable to be put into redux:

const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));

I haven't thought of a better way yet.

Copy link
Member

Choose a reason for hiding this comment

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

You can get the client windows width easily in native JS.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@Samler-Lee Samler-Lee requested a review from HFO4 July 2, 2025 12:47
@HFO4 HFO4 merged commit 3732061 into cloudreve:master Jul 3, 2025
1 check passed
@HFO4
Copy link
Member

HFO4 commented Jul 3, 2025

Good job, thanks!

@Samler-Lee Samler-Lee deleted the adaptive-app branch July 3, 2025 09:26
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.

2 participants