import {Pipe, PipeTransform} from '@angular/core';
// import {ElectronUtil} from '../util/ElectronUtil';

declare const APP_PATH;
// const isInElectron = localStorage.getItem('electron');

@Pipe({
  name: 'backgroundImage'
})
export class BackgroundImagePipe implements PipeTransform {

  transform(value: any, coursewareSid?: string) {
    // const ret = value ? `url(${value})` : '';
    const ret = value ? `url(${value})` : '';
    return ret;
    // let ret = value > 0 ? `url(/api/media-resource/${value}/file)` : '';
    // if (isInElectron && ElectronUtil.hasCached(coursewareSid, value)) {
    //   ret = `url(file://${APP_PATH}/courseware_cache/${coursewareSid}/${value})`;
    // }
    // return ret;
  }

}
