summaryrefslogtreecommitdiffstats
path: root/ui/src/components/cake-day.tsx
diff options
context:
space:
mode:
authorFilip785 <fdjuricic98@gmail.com>2020-07-08 19:46:18 +0200
committerFilip785 <fdjuricic98@gmail.com>2020-07-08 19:46:18 +0200
commit8fe8836bc263be11895fafa958409499c9e9fc9d (patch)
tree139c834b9f3245beeb7d7f101ce88c992ba77b8c /ui/src/components/cake-day.tsx
parent1b351e08aa1dfd4a6150111c9ce63b2251baa4fe (diff)
Updates to PR as requested
Diffstat (limited to 'ui/src/components/cake-day.tsx')
-rw-r--r--ui/src/components/cake-day.tsx35
1 files changed, 12 insertions, 23 deletions
diff --git a/ui/src/components/cake-day.tsx b/ui/src/components/cake-day.tsx
index 67ac7f8b..be807184 100644
--- a/ui/src/components/cake-day.tsx
+++ b/ui/src/components/cake-day.tsx
@@ -1,37 +1,26 @@
import { Component } from 'inferno';
-import moment from 'moment';
import { i18n } from '../i18next';
interface CakeDayProps {
creator_name: string;
- creator_published: string;
+ is_post_creator?: boolean;
}
export class CakeDay extends Component<CakeDayProps, any> {
render() {
- const { creator_name, creator_published } = this.props;
+ const { creator_name, is_post_creator } = this.props;
return (
- this.isCakeDay(creator_published) && (
- <div
- className="mr-lg-2 d-inline-block unselectable pointer mx-2"
- data-tippy-content={this.cakeDayTippy(creator_name)}
- >
- <svg class="icon icon-inline">
- <use xlinkHref="#icon-cake"></use>
- </svg>
- </div>
- )
- );
- }
-
- isCakeDay(input: string): boolean {
- const userCreationDate = moment.utc(input).local();
- const currentDate = moment(new Date());
-
- return (
- userCreationDate.date() === currentDate.date() &&
- userCreationDate.month() === currentDate.month()
+ <div
+ className={`mr-lg-2 d-inline-block unselectable pointer${
+ is_post_creator ? ' mx-2' : ''
+ }`}
+ data-tippy-content={this.cakeDayTippy(creator_name)}
+ >
+ <svg class="icon icon-inline">
+ <use xlinkHref="#icon-cake"></use>
+ </svg>
+ </div>
);
}