This commit is contained in:
Melody Becker 2024-09-20 16:35:59 +02:00
parent c75acc48a2
commit 5dbf3d9af2
10 changed files with 114 additions and 66 deletions

View file

@ -1,14 +1,14 @@
<div class="note">
{{!-- TODO: figure out how to make the entire note clickable for opening with something like {{on "click" (fn this.openFullView)}} --}}
<Note::UserHeader
@displayname="{{@displayname}}"
@handle="@{{@username}}@{{@serverdomain}}"
@displayname="{{@note.displayname}}"
@handle="@{{@note.username}}@{{@note.server}}"
/>
<Note::Content @content="{{@content}}" />
<Note::Content @content="{{@note.content}}" />
<div class="note-timestamps-container">
<p class="note-timestamp" id="note-edited-timestamp">Edited: At some time in
the future</p>
<p class="note-timestamp" id="note-created-timestamp">Posted: Before the Big
Bang</p>
{{#if @note.editedAt}}
<p class="note-timestamp" id="note-edited-timestamp">Edited: {{moment-format @note.editedAt}}</p>
{{/if}}
<p class="note-timestamp" id="note-created-timestamp">Posted: {{moment-format @note.createdAt ""}}</p>
</div>
</div>

View file

@ -1,26 +1,34 @@
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { action } from "@ember/object";
import Component from "@glimmer/component";
export interface NoteSignature {
// The arguments accepted by the component
Args: {
isInTimeline: boolean;
};
// Any blocks yielded by the component
Blocks: {
default: [];
};
// The element to which `...attributes` is applied in the component template
Element: null;
// The arguments accepted by the component
Args: {
isInTimeline: boolean;
note: {
content: string;
server: string;
username: string;
displayname: string;
createdAt: number;
editedAt?: number;
};
};
// Any blocks yielded by the component
Blocks: {
default: [];
};
// The element to which `...attributes` is applied in the component template
Element: null;
}
export default class Note extends Component<NoteSignature> {
@action
openFullView() {
if (this.args.isInTimeline) {
alert("Would have opened note's own view");
} else {
console.log("Alread in note specific view, can't open it again");
}
}
@action
openFullView() {
if (this.args.isInTimeline) {
alert("Would have opened note's own view");
} else {
console.log("Alread in note specific view, can't open it again");
}
}
}

View file

@ -1,5 +1,3 @@
{{#each this.notes as |note|}}
<Note />
{{/each}}
<InfinityLoader />
{{#each this.model.notes as |note|}}
<Note @isInTimeline="true" @content="{{note.content}}" @username="{{note.username}}" @serverdomain="{{note.server}}"/>
{{/each}}