Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/app/components/canvas/canvas.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class CanvasComponent implements OnInit, OnDestroy {
new FabricPostComponent(post, {
upvotes: upvotes.length,
comments: comments.length,
author: 'Anonymous',
})
);
}
Expand Down
24 changes: 14 additions & 10 deletions frontend/src/app/components/fabric-post/fabric-post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const CONTENT_EXTRA_HEIGHT = 55;
export interface PostOptions {
upvotes: number;
comments: number;
author?: string;
}

@Component({
Expand All @@ -39,16 +40,19 @@ export class FabricPostComponent extends fabric.Group {
splitByGrapheme: true,
});

const author = new fabric.Textbox(post.author, {
name: 'author',
width: 300,
left: 18,
top: title.getScaledHeight() + AUTHOR_OFFSET,
fontSize: 13,
fontFamily: 'Helvetica',
fill: '#555555',
splitByGrapheme: true,
});
const author = new fabric.Textbox(
options?.author?.toString() ?? post.author,
{
name: 'author',
width: 300,
left: 18,
top: title.getScaledHeight() + AUTHOR_OFFSET,
fontSize: 13,
fontFamily: 'Helvetica',
fill: '#555555',
splitByGrapheme: true,
}
);

const desc = new fabric.Textbox(
post.desc.length > 200 ? post.desc.substr(0, 200) + '...' : post.desc,
Expand Down