2022-08-12 10:45:04 +02:00
|
|
|
class EditableChamp::ChampLabelContentComponent < ApplicationComponent
|
2022-09-08 11:25:39 +02:00
|
|
|
def initialize(champ:, seen_at: nil)
|
|
|
|
@champ, @seen_at = champ, seen_at
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|
2022-09-09 11:36:25 +02:00
|
|
|
|
|
|
|
def highlight_if_unseen_class
|
|
|
|
if highlight?
|
|
|
|
'highlighted'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def highlight?
|
|
|
|
@champ.updated_at.present? && @seen_at&.<(@champ.updated_at)
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_format_datetime(datetime)
|
|
|
|
datetime.present? ? I18n.l(datetime) : ''
|
|
|
|
end
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|