-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
- Loading branch information
Showing
12 changed files
with
318 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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 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 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
107 changes: 107 additions & 0 deletions
107
...ns/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte
This file contains 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,107 @@ | ||
<!-- | ||
// Copyright © 2023 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 { ActivityInfoMessage } from '@hcengineering/activity' | ||
import { Employee, PersonAccount } from '@hcengineering/contact' | ||
import { | ||
Avatar, | ||
SystemAvatar, | ||
employeeByIdStore, | ||
personAccountByIdStore, | ||
personByIdStore | ||
} from '@hcengineering/contact-resources' | ||
import ActivityMessageTemplate from './ActivityMessageTemplate.svelte' | ||
import { Ref } from '@hcengineering/core' | ||
import { translate } from '@hcengineering/platform' | ||
import { MessageViewer } from '@hcengineering/presentation' | ||
import ActivityMessageHeader from './ActivityMessageHeader.svelte' | ||
export let value: ActivityInfoMessage | ||
export let showNotify: boolean = false | ||
export let isHighlighted: boolean = false | ||
export let isSelected: boolean = false | ||
export let shouldScroll: boolean = false | ||
export let embedded: boolean = false | ||
export let hasActionsMenu: boolean = true | ||
export let onClick: (() => void) | undefined = undefined | ||
$: personAccount = $personAccountByIdStore.get((value.createdBy ?? value.modifiedBy) as Ref<PersonAccount>) | ||
$: person = | ||
personAccount?.person !== undefined | ||
? $employeeByIdStore.get(personAccount.person as Ref<Employee>) ?? $personByIdStore.get(personAccount.person) | ||
: undefined | ||
let content = '' | ||
$: void translate(value.message, value.props) | ||
.then((message) => { | ||
content = message | ||
}) | ||
.catch((err) => { | ||
content = JSON.stringify(err, null, 2) | ||
}) | ||
</script> | ||
|
||
<ActivityMessageTemplate | ||
message={value} | ||
parentMessage={undefined} | ||
{person} | ||
{showNotify} | ||
{isHighlighted} | ||
{isSelected} | ||
{shouldScroll} | ||
{embedded} | ||
{hasActionsMenu} | ||
viewlet={undefined} | ||
{onClick} | ||
> | ||
<svelte:fragment slot="icon"> | ||
{#if value.icon} | ||
<SystemAvatar size="medium" icon={value.icon} iconProps={value.iconProps} /> | ||
{:else if person} | ||
<Avatar size="medium" avatar={person.avatar} name={person.name} /> | ||
{:else} | ||
<SystemAvatar size="medium" /> | ||
{/if} | ||
</svelte:fragment> | ||
<svelte:fragment slot="header"> | ||
<ActivityMessageHeader | ||
message={value} | ||
{person} | ||
object={undefined} | ||
parentObject={undefined} | ||
isEdited={false} | ||
label={value.title} | ||
/> | ||
</svelte:fragment> | ||
<svelte:fragment slot="content"> | ||
<div class="flex-row-center"> | ||
<div class="customContent"> | ||
<MessageViewer message={content} /> | ||
</div> | ||
</div> | ||
</svelte:fragment> | ||
</ActivityMessageTemplate> | ||
|
||
<style lang="scss"> | ||
.customContent { | ||
display: flex; | ||
flex-wrap: wrap; | ||
column-gap: 0.625rem; | ||
row-gap: 0.625rem; | ||
} | ||
</style> |
63 changes: 63 additions & 0 deletions
63
plugins/activity-resources/src/components/activity-message/ActivityMessageHeader.svelte
This file contains 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,63 @@ | ||
<!-- | ||
// Copyright © 2023 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 { ActivityMessage } from '@hcengineering/activity' | ||
import { Person } from '@hcengineering/contact' | ||
import { Doc } from '@hcengineering/core' | ||
import notification from '../../plugin' | ||
import { Label } from '@hcengineering/ui' | ||
import { DocNavLink } from '@hcengineering/view-resources' | ||
import { LinkData, getLinkData } from '../../activityMessagesUtils' | ||
import { IntlString } from '@hcengineering/platform' | ||
export let message: ActivityMessage | ||
export let person: Person | undefined | ||
export let object: Doc | undefined | ||
export let parentObject: Doc | undefined | ||
export let label: IntlString | undefined = undefined | ||
export let isEdited: boolean = false | ||
let linkData: LinkData | undefined = undefined | ||
$: void getLinkData(message, object, parentObject, person).then((data) => { | ||
linkData = data | ||
}) | ||
</script> | ||
|
||
<span class="text-sm lower"> | ||
{#if label} | ||
<Label {label} /> | ||
{/if} | ||
</span> | ||
|
||
{#if linkData} | ||
<span class="text-sm lower"><Label label={linkData.preposition} /></span> | ||
<span class="text-sm"> | ||
<DocNavLink {object} component={linkData.panelComponent} shrink={0}> | ||
<span class="overflow-label select-text">{linkData.title}</span> | ||
</DocNavLink> | ||
</span> | ||
{#if isEdited} | ||
<span class="text-sm lower"><Label label={notification.string.Edited} /></span> | ||
{/if} | ||
{/if} | ||
|
||
<style lang="scss"> | ||
span { | ||
margin-left: 0.25rem; | ||
font-weight: 400; | ||
line-height: 1.25rem; | ||
} | ||
</style> |
This file contains 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 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.