<commit_before>import * as React from "react";
import { IAppContext } from "@sdl/dd/container/App/App";
import { ISearchQueryResult } from "interfaces/Search";

import { Url } from "utils/Url";
import { Link } from "react-router";

import "./SearchResultItem.less";

/**
 * Options used to convert date
 */
const DATE_OPTIONS = { year: "numeric", month: "numeric", day: "numeric" };

/**
 * SearchResultItem props
 *
 * @export
 * @interface ISearchResultItemProps
 */
export interface ISearchResultItemProps {
    index?: number;
    searchResult: ISearchQueryResult;
}

/**
 * SearchResultItem
 */
export const SearchResultItem: React.StatelessComponent<ISearchResultItemProps> =
    (props: ISearchResultItemProps, context: IAppContext): JSX.Element => {

        /**
         * Add to bookmarks
         */
        function _addToBookmarks(url: string, title: string): void {
            // there is no nice crossbrowser solution.
            console.log("Add to bookmark url: " + url);
        }

        const { searchResult } = props;
        const { localizationService } = context.services;
        const { formatMessage, getLanguage } = localizationService;

        let bottomInfo: string[] = [];
        const modifiedDate = searchResult.lastModifiedDate;
        if (modifiedDate) {
            bottomInfo.push(`${formatMessage("search.result.last.updated", [modifiedDate.toLocaleString(getLanguage(), DATE_OPTIONS)])}`);
        }

        const language = localizationService.getLanguages().filter(x => x.iso == searchResult.language)[0];
        if (language && language.name) {
            bottomInfo.push(`${formatMessage("search.result.language", [language.name])}`);
        }

        return (
            <div className="sdl-dita-delivery-search-result-item" tabIndex={props.index}>
                <h3>
                    <Link title={searchResult.pageTitle}
                        to={Url.getPageUrl(searchResult.publicationId, searchResult.pageId, searchResult.publicationTitle, searchResult.pageTitle)}>
                        {searchResult.pageTitle}
                    </Link>
                    <button title={formatMessage("search.results.bookmark")} onClick={() => _addToBookmarks(
                        Url.getPageUrl(searchResult.publicationId, searchResult.pageId, searchResult.publicationTitle, searchResult.pageTitle),
                        searchResult.pageTitle)} />
                </h3>
                <nav>
                    {searchResult.productFamilyTitle &&
                        <Link title={searchResult.productFamilyTitle}
                            to={Url.getProductFamilyUrl(searchResult.productFamilyTitle, searchResult.productReleaseVersionTitle)}>
                            {searchResult.productFamilyTitle}
                        </Link>
                    }
                    {searchResult.productFamilyTitle && searchResult.productReleaseVersionTitle &&
                        <Link title={searchResult.productReleaseVersionTitle}
                            to={Url.getProductFamilyUrl(searchResult.productFamilyTitle, searchResult.productReleaseVersionTitle)}>
                            {searchResult.productReleaseVersionTitle}
                        </Link>
                    }
                    <Link title={searchResult.publicationTitle}
                        to={Url.getPublicationUrl(searchResult.publicationId, searchResult.publicationTitle)}>
                        {searchResult.publicationTitle}
                    </Link>
                </nav>
                <p>{searchResult.content}</p>
                {bottomInfo.map((x, i) => <span key={i}>{x}</span>)}
            </div>);
    };

SearchResultItem.contextTypes = {
    services: React.PropTypes.object.isRequired
} as React.ValidationMap<IAppContext>;
<commit_msg>SCTCD-128 | Design Tweaks | removed unnecessary options<commit_after>import * as React from "react";
import { IAppContext } from "@sdl/dd/container/App/App";
import { ISearchQueryResult } from "interfaces/Search";

import { Url } from "utils/Url";
import { Link } from "react-router";

import "./SearchResultItem.less";

/**
 * SearchResultItem props
 *
 * @export
 * @interface ISearchResultItemProps
 */
export interface ISearchResultItemProps {
    index?: number;
    searchResult: ISearchQueryResult;
}

/**
 * SearchResultItem
 */
export const SearchResultItem: React.StatelessComponent<ISearchResultItemProps> =
    (props: ISearchResultItemProps, context: IAppContext): JSX.Element => {

        /**
         * Add to bookmarks
         */
        function _addToBookmarks(url: string, title: string): void {
            // there is no nice crossbrowser solution.
            console.log("Add to bookmark url: " + url);
        }

        const { searchResult } = props;
        const { localizationService } = context.services;
        const { formatMessage, getLanguage } = localizationService;

        let bottomInfo: string[] = [];
        const modifiedDate = searchResult.lastModifiedDate;
        if (modifiedDate) {
            bottomInfo.push(`${formatMessage("search.result.last.updated", [modifiedDate.toLocaleDateString(getLanguage())])}`);
        }

        const language = localizationService.getLanguages().filter(x => x.iso == searchResult.language)[0];
        if (language && language.name) {
            bottomInfo.push(`${formatMessage("search.result.language", [language.name])}`);
        }

        return (
            <div className="sdl-dita-delivery-search-result-item" tabIndex={props.index}>
                <h3>
                    <Link title={searchResult.pageTitle}
                        to={Url.getPageUrl(searchResult.publicationId, searchResult.pageId, searchResult.publicationTitle, searchResult.pageTitle)}>
                        {searchResult.pageTitle}
                    </Link>
                    <button title={formatMessage("search.results.bookmark")} onClick={() => _addToBookmarks(
                        Url.getPageUrl(searchResult.publicationId, searchResult.pageId, searchResult.publicationTitle, searchResult.pageTitle),
                        searchResult.pageTitle)} />
                </h3>
                <nav>
                    {searchResult.productFamilyTitle &&
                        <Link title={searchResult.productFamilyTitle}
                            to={Url.getProductFamilyUrl(searchResult.productFamilyTitle, searchResult.productReleaseVersionTitle)}>
                            {searchResult.productFamilyTitle}
                        </Link>
                    }
                    {searchResult.productFamilyTitle && searchResult.productReleaseVersionTitle &&
                        <Link title={searchResult.productReleaseVersionTitle}
                            to={Url.getProductFamilyUrl(searchResult.productFamilyTitle, searchResult.productReleaseVersionTitle)}>
                            {searchResult.productReleaseVersionTitle}
                        </Link>
                    }
                    <Link title={searchResult.publicationTitle}
                        to={Url.getPublicationUrl(searchResult.publicationId, searchResult.publicationTitle)}>
                        {searchResult.publicationTitle}
                    </Link>
                </nav>
                <p>{searchResult.content}</p>
                {bottomInfo.map((x, i) => <span key={i}>{x}</span>)}
            </div>);
    };

SearchResultItem.contextTypes = {
    services: React.PropTypes.object.isRequired
} as React.ValidationMap<IAppContext>;

{'fraction_non_alphanumeric': 0.1078811369509044, 'fraction_numerical': 0.0011627906976744186, 'mean_word_length': 2.0179337231968812, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 53, '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': '5624087', 'n_tokens_mistral': 1966, 'n_tokens_neox': 1858, 'n_words': 323}