Commit 2f6f110a authored by David Haynes's avatar David Haynes 🙆
Browse files

Initial abstraction of ScheduleBadge

parent 0cf2318a
import { CourseSection } from '../../util/CourseSection'; import CourseSection from '../../util/CourseSection';
import { ADD_COURSE_SECTION, REMOVE_COURSE_SECTION } from './schedule.action-types'; import { ADD_COURSE_SECTION, REMOVE_COURSE_SECTION } from './schedule.action-types';
export interface ScheduleAction { export interface ScheduleAction {
......
import { CourseSection } from '../../util/CourseSection'; import CourseSection from '../../util/CourseSection';
import { SET_SEARCH_RESULTS } from './search.action-types'; import { SET_SEARCH_RESULTS } from './search.action-types';
export interface SearchAction { export interface SearchAction {
......
import * as React from 'react'; import * as React from 'react';
import { Container } from 'reactstrap'; import { Container } from 'reactstrap';
import Schedule from '../containers/Schedule';
import Search from '../containers/Search'; import Search from '../containers/Search';
import CourseSectionCard from './CourseSectionCard'; import CourseSectionCard from './CourseSectionCard';
import Header from './Header'; import Header from './Header';
...@@ -9,10 +10,10 @@ require('../css/core.css'); ...@@ -9,10 +10,10 @@ require('../css/core.css');
const App = () => ( const App = () => (
<div> <div>
<Container> <Container>
<Schedule />
<Header /> <Header />
<Search /> <Search />
<CourseSectionCard /> <CourseSectionCard />
{/* <Schedule /> */}
</Container> </Container>
</div> </div>
); );
......
...@@ -5,12 +5,6 @@ require('../css/icon-badge.css'); ...@@ -5,12 +5,6 @@ require('../css/icon-badge.css');
const Header = () => ( const Header = () => (
<div> <div>
{/* TODO Extract into its own components with state management. */}
<Row className="justify-content-end my-5 px-3">
<span className="fa-stack fa-3x has-badge" data-count="0">
<i className="fa fas fa-shopping-bag fa-stack-1x" />
</span>
</Row>
<Row className="justify-content-center my-5"> <Row className="justify-content-center my-5">
<h1> <h1>
<i className="far fa-calendar-alt" /> Schedules <i className="far fa-calendar-alt" /> Schedules
......
import * as React from 'react';
import { Row } from 'reactstrap';
import CourseSection from '../util/CourseSection';
interface ScheduleBadgeProps {
schedule: CourseSection[];
}
const ScheduleBadge = ({ schedule }: ScheduleBadgeProps) => (
<Row className="justify-content-end my-5 px-3">
<span className="fa-stack fa-3x has-badge" data-count={schedule.length}>
<i className="fa fas fa-shopping-bag fa-stack-1x" />
</span>
</Row>
);
export default ScheduleBadge;
import * as React from 'react'; import * as React from 'react';
import { CourseSection } from '../util/CourseSection'; import CourseSection from '../util/CourseSection';
interface Props { interface Props {
courses: CourseSection[]; courses: CourseSection[];
......
import * as React from 'react'; import * as React from 'react';
import { CourseSection } from '../util/CourseSection'; import CourseSection from '../util/CourseSection';
import ScheduleList from './ScheduleList'; import ScheduleBadge from './ScheduleBadge';
interface SearchRootProps { interface SearchRootProps {
schedule: CourseSection[]; schedule: CourseSection[];
...@@ -17,7 +17,8 @@ interface SearchRootProps { ...@@ -17,7 +17,8 @@ interface SearchRootProps {
const ScheduleRoot = ({ schedule, removeCourseSection }: SearchRootProps) => ( const ScheduleRoot = ({ schedule, removeCourseSection }: SearchRootProps) => (
<div> <div>
<ScheduleList courses={schedule} selectCourseCallback={removeCourseSection} /> <ScheduleBadge schedule={schedule} />
{/* <ScheduleList courses={schedule} selectCourseCallback={removeCourseSection} /> */}
{/* <button onClick={generateSchedule}>Generate Schedule</button> */} {/* <button onClick={generateSchedule}>Generate Schedule</button> */}
</div> </div>
); );
......
import * as React from 'react'; import * as React from 'react';
import SearchBar from '../components/SearchBar'; import SearchBar from '../components/SearchBar';
import { CourseSection } from '../util/CourseSection'; import CourseSection from '../util/CourseSection';
interface SearchRootProps { interface SearchRootProps {
searchResults: CourseSection[]; searchResults: CourseSection[];
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
import { ADD_COURSE_SECTION, REMOVE_COURSE_SECTION } from '../actions/schedule/schedule.action-types'; import { ADD_COURSE_SECTION, REMOVE_COURSE_SECTION } from '../actions/schedule/schedule.action-types';
import { ScheduleAction } from '../actions/schedule/schedule.actions'; import { ScheduleAction } from '../actions/schedule/schedule.actions';
import { CourseSection } from '../util/CourseSection'; import CourseSection from '../util/CourseSection';
export type ScheduleState = CourseSection[]; export type ScheduleState = CourseSection[];
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
import { SET_SEARCH_RESULTS } from '../actions/search/search.action-types'; import { SET_SEARCH_RESULTS } from '../actions/search/search.action-types';
import { SearchAction } from '../actions/search/search.actions'; import { SearchAction } from '../actions/search/search.actions';
import { CourseSection } from '../util/CourseSection'; import CourseSection from '../util/CourseSection';
export type SearchState = CourseSection[]; export type SearchState = CourseSection[];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Common object interface for all "Section"s. * Common object interface for all "Section"s.
*/ */
export interface CourseSection { interface CourseSection {
id: number; id: number;
name: string; name: string;
title: string; title: string;
...@@ -14,3 +14,5 @@ export interface CourseSection { ...@@ -14,3 +14,5 @@ export interface CourseSection {
startTime: string; startTime: string;
endTime: string; endTime: string;
} }
export default CourseSection;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment