Skip to content

Commit

Permalink
Minor UI improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
wongjiahau committed Dec 1, 2018
1 parent ee03631 commit 5d07e66
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
9 changes: 4 additions & 5 deletions ts/model/timetableSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ export class SubjectSummary {
this.Tutorial = extract("T");
this.Practical = extract("P");

const creditHour = slots[0].CreditHour;
// Why slots[0] ?
// Actually it can be any slots, because the CreditHour of each slots
// from the same subject will have the same value
// This is a form of data denormalization
// According to Dr. Madhavan,
// the credit hour can be obtained from the last digit of the subject code
const creditHour = this.SubjectCode.slice(-1)[0];

this.CreditHour = parseFloat(creditHour ? creditHour : "0.0");
}

Expand Down
12 changes: 1 addition & 11 deletions ts/react/slotView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ ISlotViewState > {
aria-owns={Boolean(this.state.anchorEl) ? "popover" : undefined}
aria-haspopup="true"
>
<b>
{getSlotContent(slot)}
</b>
{getSlotContent(slot)}
<br/> {slot.Room[slot.CurrentChoice]}
<br/> {slot.WeekNumber[slot.CurrentChoice]}
</div>
Expand Down Expand Up @@ -145,14 +143,6 @@ ISlotViewState > {

);
}

public componentDidUpdate() {
if (this.state.isMenuOpen) {
console.log(this.state.isMenuOpen);
console.log(this.props.slot);
}
}

}

function tooltipTitle(s : ISlotViewModel, isShowingAlternativeSlotOfThisSlot: boolean) {
Expand Down
8 changes: 3 additions & 5 deletions ts/react/timetableSummaryView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const find = require("lodash.find");
import * as React from "react";
import {ISlotViewModel} from "../model/slotViewModel";
import {SubjectSummary, TimetableSummary} from "../model/timetableSummary";
import { ColorHash } from "../util/colorhash";
import {Colors} from "./colors/colors";
import {GenerateColorScheme} from "./colors/generateColorScheme";

interface ITimetableSummaryViewProps {
slots : ISlotViewModel[];
Expand All @@ -16,10 +13,11 @@ export class TimetableSummaryView extends React.Component < ITimetableSummaryVie
return false;
}
const subjectSummaries = new TimetableSummary(this.props.slots).SubjectSummaries;
const colorSchemes = GenerateColorScheme(this.props.slots);
const tableStyle : React.CSSProperties = {
border: "1px solid black",
borderCollapse: "collapse"
borderCollapse: "collapse",
fontSize: "16px",
margin: "10px"
};
return (
// @ts-ignore
Expand Down
2 changes: 2 additions & 0 deletions ts/react/timetableView/timetableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export class TimetableView extends React.Component < ITimetableViewProps, ITimet
const divStyle : React.CSSProperties = {
backgroundColor: Colors.WhiteSmoke,
borderStyle: "solid",
borderWidth: "1px",
borderRadius: "5px",
fontFamily: "roboto",
margin: "auto",
position: "relative",
Expand Down

0 comments on commit 5d07e66

Please sign in to comment.