Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Live page and comments

Daniel Antonio Conte edited this page Sep 5, 2018 · 6 revisions

Comment layout

Picture

Title

Body

Comment channel

Each comment is related to a single channel, which identify where it should be displayed. Possible values are 'live', 'alerts' (raise a Push Notification) or 'item_[HERE THE ITEM ID]'.

On future release could be used to chat, providing 'chatroom id' as channel.

Comment model

export class Comment {  
  _id?: string;
  channel: string;
  type: string;
  data?: Object; 
  created: any;
  published: any;
  modified: any;
  isPublished: boolean;
  site_id: number;

  constructor(type: string) {
    this.type = type;
    this.channel = "live";
    this.created = firebase.firestore.FieldValue.serverTimestamp();
    this.published = firebase.firestore.FieldValue.serverTimestamp();
    this.modified = firebase.firestore.FieldValue.serverTimestamp();
    this.isPublished = true;
    this.data = new Object();
  }
}

Picture

Could be clickable if user.picture (live-comment or item-comment for example), and lead to user profile.

Title

Except if title equals user.displayName, need to be translated.

Data

Is an Object who keeps the specific information about the comments. On Anniversaries for example, it contains a list of contacts.

Type

Setting the comment type, ex.: {'anniversaries', 'message','ranking'}

Each type uses a different component, so according with the field value we render the correctly component. Ex: type=Message => MessageComponent, type=Anniversaries => AnniversariesComponent.

Comment types

Message

 export interface Message {
  author: Contact,
  description: string,
  itemDetails: {
    title: string,
    id: string
  }
  media: [
    {
      url: string
    }
  ]
}

Url shortner & tracking open link

Could add params to track open link utm_source, utm_medium, utm_campaign.

anniversaries

export interface Anniversaries {  
  picture: string,
  title: string,
  contacts: Array<Contact>
}

ranking

event

Adding new comment type

Define data for each comment types

/!\ use camelCase for firebase fields name and snake_case for meumobi fields name

Comment controls

Any comment could be deleted by user.admin or its author

Comment models

On ./src/models/comment-types/ folder add one file per type (anniversaries.ts, message.ts, etc.)