-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Update cards feed view #9979
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
Update cards feed view #9979
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
08f0789
New card view
ArtyomSavchenko 6953b82
Update card feed view
ArtyomSavchenko 735feee
Fix content preview
ArtyomSavchenko 1c45459
Fix formatting
ArtyomSavchenko 846e761
Merge branch 'develop' of https://github.com/hcengineering/platform i…
ArtyomSavchenko c757e77
Minor fixes
ArtyomSavchenko 0cfdf90
Fix layout
ArtyomSavchenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
plugins/card-resources/src/components/ColoredCardIcon.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <!-- | ||
| // Copyright © 2025 Hardcore Engineering Inc. | ||
| // | ||
| // Licensed under the Eclipse Public License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| --> | ||
|
|
||
| <script lang="ts"> | ||
| import cardPlugin, { Card, MasterTag } from '@hcengineering/card' | ||
| import { getClient } from '@hcengineering/presentation' | ||
| import { Component, getPlatformColorDef, themeStore } from '@hcengineering/ui' | ||
| import communication from '@hcengineering/communication' | ||
|
|
||
| import NotifyMarker from './NotifyMarker.svelte' | ||
|
|
||
| export let card: Card | ||
| export let count: number = 0 | ||
|
|
||
| const client = getClient() | ||
| const hierarchy = client.getHierarchy() | ||
|
|
||
| $: size = hierarchy.isDerived(card._class, communication.type.Direct) ? 'large' : 'medium' | ||
|
|
||
| // Get the color from the card's MasterTag class, similar to MasterTagSelector | ||
| $: clazz = hierarchy.getClass(card._class) as MasterTag | ||
| $: color = clazz.background ?? 0 | ||
| $: platformColor = getPlatformColorDef(color, $themeStore.dark) | ||
|
|
||
| function getIconStyle (platformColor: any): string { | ||
| return ` | ||
| background: ${platformColor.color + '1a'}; | ||
| border: 1px solid ${platformColor.color + '33'}; | ||
| color: ${platformColor.color}; | ||
| fill: ${platformColor.color}; | ||
| ` | ||
| } | ||
| </script> | ||
|
|
||
| <div class="card-icon" style={getIconStyle(platformColor)}> | ||
| <Component is={cardPlugin.component.CardIcon} props={{ value: card, size }} /> | ||
|
|
||
| {#if count > 0} | ||
| <div class="card-icon__marker"> | ||
| <NotifyMarker size="small" /> | ||
| </div> | ||
| {/if} | ||
| </div> | ||
|
|
||
| <style lang="scss"> | ||
| .card-icon { | ||
| display: inline-flex; | ||
| position: relative; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 2.5rem; | ||
| height: 2.5rem; | ||
| min-width: 2.5rem; | ||
| min-height: 2.5rem; | ||
| border-radius: var(--medium-BorderRadius); | ||
|
|
||
| // Default fallback colors - will be overridden by inline styles | ||
| color: var(--global-secondary-TextColor); | ||
| background-color: var(--global-ui-BackgroundColor); | ||
| border: 1px solid var(--global-subtle-ui-BorderColor); | ||
| fill: var(--global-secondary-TextColor); | ||
|
|
||
| &__marker { | ||
| position: absolute; | ||
| top: -0.375rem; | ||
| right: 0; | ||
| transform: translateX(calc(100% - 0.875rem)); | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| } | ||
| } | ||
| </style> |
69 changes: 69 additions & 0 deletions
69
plugins/card-resources/src/components/ContentPreview.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <!-- | ||
| // Copyright © 2025 Hardcore Engineering Inc. | ||
| // | ||
| // Licensed under the Eclipse Public License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. You may | ||
| // obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| --> | ||
|
|
||
| <script lang="ts"> | ||
| import { Card } from '@hcengineering/card' | ||
| import { WithLookup } from '@hcengineering/core' | ||
| import { ShowMore } from '@hcengineering/ui' | ||
|
|
||
| import ContentEditor from './ContentEditor.svelte' | ||
|
|
||
| export let card: WithLookup<Card> | ||
| export let maxHeight: string = '30rem' | ||
| export let collapsible: boolean = true | ||
| export let compact: boolean = false | ||
|
|
||
| const remFactor = 16 | ||
|
|
||
| // Function to safely parse maxHeight with fallback | ||
| function getMaxSize (maxHeight: string): number { | ||
| const remValue = parseFloat(maxHeight.replace('rem', '')) | ||
| if (isNaN(remValue) || remValue <= 0) { | ||
| return 30 * remFactor | ||
| } | ||
| return remValue * remFactor | ||
| } | ||
| </script> | ||
|
|
||
| <div class="content-preview" class:compact> | ||
| <ShowMore limit={getMaxSize(maxHeight)} ignore={!collapsible}> | ||
| <div class="content-wrapper"> | ||
| <ContentEditor | ||
| object={card} | ||
| readonly={true} | ||
| editorAttributes={{ style: 'font-size: 0.875rem; margin-top: -0.5rem;' }} | ||
| /> | ||
| </div> | ||
| </ShowMore> | ||
| </div> | ||
|
|
||
| <style lang="scss"> | ||
| .content-preview { | ||
| width: 100%; | ||
| color: var(--global-secondary-TextColor); | ||
| position: relative; // Ensure proper positioning context for ShowMore button | ||
|
|
||
| &.compact { | ||
| font-size: 0.875rem; | ||
| } | ||
| } | ||
|
|
||
| .content-wrapper { | ||
| width: 100%; | ||
| overflow: visible; // Changed from hidden to allow ShowMore button to be visible | ||
| word-wrap: break-word; | ||
| position: relative; // Additional positioning context | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.