<commit_before>// @flow

import React from "react";
import Section from "../../../components/enums/Section.js";
import url from "../../utils/url.js";
import Moment from "react-moment";
import type {Dictionary} from "../../types/Generics.jsx";
import Sort from "../../utils/sort.js";
import Truncate from "../../utils/truncate.js";
import GlyphStyles from "../../utils/glyphs.js";
import utils from "../../utils/utils.js";
import {EventTileAPIData} from "../../utils/EventAPIUtils.js";
import type {TagDefinition} from "../../utils/ProjectAPIUtils.js";

type Props = {|
  event: EventTileAPIData,
  tagDictionary: Dictionary<TagDefinition>,
  maxTextLength: number,
  maxIssuesCount: number
|};
//fontawesome fixed width class
const glyphFixedWidth = " fa-fw";

class EventCard extends React.PureComponent<Props> {
  constructor(): void {
    super();
  }

  render(): React$Node {
    return (
        <div className="EventCard-root">
          <a href={url.section(Section.AboutEvent, {id: this.props.event.event_id})}
            rel="noopener noreferrer">
            {this._renderEventLogo()}
            {this._renderEventInformation()}
            {this._renderEventTime()}
          </a>
        </div>
    );
  }

  _renderEventLogo(): React$Node {
    return (
      <div className="EventCard-logo">
        <img src={this.props.event && this.props.event.event_thumbnail ? this.props.event.event_thumbnail.publicUrl : "/static/images/projectlogo-default.png"}/>
      </div>
    );
  }

  //TODO: add organizer field to create event form/db record so we can use that instead
  _renderEventInformation(): React$Node {
    const Event: EventTileAPIData = this.props.event;
    const location: string = Event.event_location;
    return (
      <div className="EventCard-info">
        <h2>{Event.event_name}</h2>
        <h4>
          DemocracyLab
        </h4>
        {location &&
          <ul>
            <li>
              <i className={GlyphStyles.MapMarker + glyphFixedWidth}></i>
              {location}<commit_msg>Use Glyph library for event card<commit_after>// @flow

import React from "react";
import Section from "../../../components/enums/Section.js";
import url from "../../utils/url.js";
import Moment from "react-moment";
import type {Dictionary} from "../../types/Generics.jsx";
import Sort from "../../utils/sort.js";
import Truncate from "../../utils/truncate.js";
import {Glyph, GlyphWidth, GlyphStyles} from "../../utils/glyphs.js";
import utils from "../../utils/utils.js";
import {EventTileAPIData} from "../../utils/EventAPIUtils.js";
import type {TagDefinition} from "../../utils/ProjectAPIUtils.js";

type Props = {|
  event: EventTileAPIData,
  tagDictionary: Dictionary<TagDefinition>,
  maxTextLength: number,
  maxIssuesCount: number
|};

class EventCard extends React.PureComponent<Props> {
  constructor(): void {
    super();
  }

  render(): React$Node {
    return (
        <div className="EventCard-root">
          <a href={url.section(Section.AboutEvent, {id: this.props.event.event_id})}
            rel="noopener noreferrer">
            {this._renderEventLogo()}
            {this._renderEventInformation()}
            {this._renderEventTime()}
          </a>
        </div>
    );
  }

  _renderEventLogo(): React$Node {
    return (
      <div className="EventCard-logo">
        <img src={this.props.event && this.props.event.event_thumbnail ? this.props.event.event_thumbnail.publicUrl : "/static/images/projectlogo-default.png"}/>
      </div>
    );
  }

  //TODO: add organizer field to create event form/db record so we can use that instead
  _renderEventInformation(): React$Node {
    const Event: EventTileAPIData = this.props.event;
    const location: string = Event.event_location;
    return (
      <div className="EventCard-info">
        <h2>{Event.event_name}</h2>
        <h4>
          DemocracyLab
        </h4>
        {location &&
          <ul>
            <li>
              <i className={Glyph(GlyphStyles.MapMarker, GlyphWidth.Fixed)}></i>
              {location}
{'fraction_non_alphanumeric': 0.1542645241038319, 'fraction_numerical': 0.001977750309023486, 'mean_word_length': 2.6983546617915906, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '14290', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1218, 'n_words': 275}