linstrom/frontend-reactive/app/components/note.ts

35 lines
766 B
TypeScript
Raw Normal View History

2024-09-20 14:35:59 +00:00
import { action } from "@ember/object";
import Component from "@glimmer/component";
2024-09-19 11:50:04 +00:00
export interface NoteSignature {
2024-09-20 14:35:59 +00:00
// 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;
2024-09-19 11:50:04 +00:00
}
export default class Note extends Component<NoteSignature> {
2024-09-20 14:35:59 +00:00
@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");
}
}
2024-09-19 11:50:04 +00:00
}