Skip to content

Fix space icon sizing with fallback image#252

Merged
kulmann merged 1 commit intomainfrom
fix-space-icons
Mar 3, 2025
Merged

Fix space icon sizing with fallback image#252
kulmann merged 1 commit intomainfrom
fix-space-icons

Conversation

@AlexAndBear
Copy link
Copy Markdown
Member

@AlexAndBear AlexAndBear commented Feb 28, 2025

Description

successor of #248

image image

Related Issue

  • Fixes

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Types of changes

  • New feature (an additional functionality that doesn't break existing code)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear
Copy link
Copy Markdown
Member Author

Note: In order to make this work, we need to run pnpm build, as the assets needs to be bundled (image will be requested from the server url). Which also means, to have it work without pnpm build, it requires a new docker image

@AlexAndBear AlexAndBear requested a review from kulmann February 28, 2025 10:00
@AlexAndBear AlexAndBear marked this pull request as ready for review February 28, 2025 10:00
@kulmann kulmann requested a review from Copilot February 28, 2025 15:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR fixes how space icons are loaded by incorporating a default space icon when none is provided and adjusting asset management in the build configuration.

  • Updates useLoadPreview to fetch and cache a default space icon.
  • Extends vite.config.ts to copy image assets.
  • Introduces a reactive defaultSpaceImageBlobURL and minor UI tweaks in Projects.vue for disabled previews.

Reviewed Changes

File Description
packages/web-pkg/src/composables/resources/useLoadPreview.ts Loads and caches a default space icon when space image data is missing
vite.config.ts Adds 'images' directory to static asset copy configuration
packages/web-pkg/src/composables/piniaStores/spaces.ts Adds defaultSpaceImageBlobURL state and its setter for space icon management
packages/web-app-files/src/views/spaces/Projects.vue Adds UI classes for table previews reflecting disabled state

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

packages/web-pkg/src/composables/resources/useLoadPreview.ts:107

  • Ensure that the blob URL retrieved from httpAuthenticated.get is used immediately rather than relying on the ref update from setdefaultSpaceImageBlobURL; this can prevent potential race conditions when reading unref(defaultSpaceImageBlobURL). Consider assigning the created URL to a variable and use it directly for resource.thumbnail and the return value.
resource.thumbnail = unref(defaultSpaceImageBlobURL)

packages/web-pkg/src/composables/piniaStores/spaces.ts:114

  • Consider renaming 'setdefaultSpaceImageBlobURL' to 'setDefaultSpaceImageBlobURL' for improved readability and consistency with naming conventions.
const setdefaultSpaceImageBlobURL = (blobURL: string) => {

Comment thread packages/web-pkg/src/composables/piniaStores/spaces.ts Outdated
Comment thread packages/web-pkg/src/composables/resources/useLoadPreview.ts Outdated
Comment thread packages/web-pkg/src/composables/resources/useLoadPreview.ts Outdated
Copy link
Copy Markdown
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Uh nice, thank you! This looks great and consistent now in the different states. 💪

@kulmann kulmann merged commit 0e9496d into main Mar 3, 2025
@kulmann kulmann deleted the fix-space-icons branch March 3, 2025 09:53
@kulmann kulmann changed the title Fix space icons Fix space icon sizing with fallback image Mar 17, 2025
@openclouders openclouders mentioned this pull request Mar 17, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants