add service to feed json data into components, add interfaces for Case Studies and Testimonials, and add case study data

This commit is contained in:
eleanor 2018-11-09 10:40:06 -05:00
parent 5f73f5b052
commit de22e5d81b
4 changed files with 96 additions and 1 deletions

37
src/app/api.service.ts Normal file
View File

@ -0,0 +1,37 @@
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { CaseStudy, Testimonial } from './interfaces';
@Injectable()
export class ApiService {
// Right now we're just using this for grabbing data from json files here, but maybe we'll expand to having a real back end one day
constructor(private httpClient: HttpClient) {
}
public getCaseStudies(): Observable<CaseStudy[]> {
return this.httpClient.get<CaseStudy[]>('./assets/json/case-studies.json');
// .pipe((catchError(this.handleError)));
}
// private handleError(error: HttpErrorResponse) {
// let message = 'Something bad happened; please try again later.';
// if (error.error instanceof ErrorEvent) {
// // A client-side or network error occurred. Handle it accordingly.
// console.error('An error occurred:', error.error.message);
// } else {
// // The backend returned an unsuccessful response code.
// // The response body may contain clues as to what went wrong,
// console.error(
// `Backend returned a status code ${error.status}, ` +
// `Code was: ${JSON.stringify(error.error.code)}, ` +
// `Message was: ${JSON.stringify(error.error.message)}`);
// message = error.error.message;
// }
// // return an observable with a user-facing error message
// // FIXME: Log all error messages to Google Analytics
// return throwError(message);
// }
}

View File

@ -9,8 +9,10 @@ import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { ApiService} from './api.service';
import { AboutUsComponent } from './about-us/about-us.component'; import { AboutUsComponent } from './about-us/about-us.component';
import { CaseStudiesComponent } from './case-studies/case-studies.component'; import { CaseStudiesComponent } from './case-studies/case-studies.component';
import { ContactUsComponent } from './contact-us/contact-us.component'; import { ContactUsComponent } from './contact-us/contact-us.component';
@ -32,13 +34,16 @@ import { MenuComponent } from './menu/menu.component';
BrowserModule, BrowserModule,
BrowserAnimationsModule, BrowserAnimationsModule,
FlexLayoutModule, FlexLayoutModule,
HttpClientModule,
MatCardModule, MatCardModule,
MatIconModule, MatIconModule,
MatMenuModule, MatMenuModule,
MatTabsModule, MatTabsModule,
MatToolbarModule MatToolbarModule
], ],
providers: [], providers: [
ApiService
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

19
src/app/interfaces.ts Normal file
View File

@ -0,0 +1,19 @@
export interface CaseStudy {
projectName: string;
tagLine: string;
description: string;
organizationName: string;
imageLink: string;
featureLink: string;
testimonials?: Testimonial[];
}
export interface Testimonial {
name: string;
title: string;
quote: string;
link?: string;
caseStudy?: CaseStudy;
}

View File

@ -0,0 +1,34 @@
[
{
"projectName": "MindTrails",
"tagLine": "Facilitating Research",
"description": "Since 2014, Sartography has provided the technical leadership for the MindTrails project, an iterative series of psychology studies. Working closely with Professor Bethany Teachman and her lab, we continue to enhance and refine our approval to behavioral modification with scientific rigor. Working with the University of Virginias information security group, Sartography designed processes to safely collect sensitive medical information. We continue to evolve our approach to gaining and retaining participants as we build more and more engaging experiences that reduce attrition and inspire real change in people's lives.",
"organizationName": "University of Virginia",
"imageLink": "../../assets/images/case-studies/mindtrails.png",
"featureLink": "../../assets/images/case-studies/mindtrails_feature.png"
},
{
"projectName": "Cadre Academy",
"tagLine": "Engaging the Community",
"description": "Working with the Research Computing department of the School of Medicine at UVA we created a platform where students, community members, and faculty could sign up for free workshops offered across the campus. Integrating with UVAs two factor authentication system, we created a streamlined signup process. To help users find the right classes we provide tools for organizing workshops into tracks - taking users from introductory materials to advanced specializations.",
"organizationName": "University of Virginia",
"imageLink": "../../assets/images/case-studies/cadre.png",
"featureLink": "../../assets/images/case-studies/cadre_feature.png"
},
{
"projectName": "iThriv",
"tagLine": "Managing Complexity",
"description": "The number of biomedical resources available to Researchers, Clinicians and the general public is exploding. An emerging discipline of Translational Medicine hopes to expedite the discovery of new tools and treatments in this multidisciplinary world. As a first step we helped create the iTrhiv Portal, a multi-institutional collaboration of Virginia universities and private organizations that helps everyone learn about and access information critical to their work and health.",
"organizationName": "University of Virginia",
"imageLink": "../../assets/images/case-studies/ithriv.png",
"featureLink": "../../assets/images/case-studies/ithriv_feature.png"
},
{
"projectName": "Full Genomes",
"tagLine": "Invigorating Business Software",
"description": "Full Genomes provides unusually detailed DNA sequencing to their clients. After some troubles with a previous consulting company they engaged us to get their development back on track. Our efforts included updating the e-commerce section of their website, integrating their backend processing, and updating the interface to a more modern look and feel that is mobile friendly.",
"organizationName": "Full Genomes",
"imageLink": "../../assets/images/case-studies/full_genomes.png",
"featureLink": "../../assets/images/case-studies/full_genomes_feature.png"
}
]