Skip to content

Commit

Permalink
Fix #369: Adding Flexible Day Calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoarthur0 committed Oct 3, 2020
1 parent 82d51a0 commit 2776f98
Show file tree
Hide file tree
Showing 9 changed files with 999 additions and 53 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
- Enhancement: [#328] Swap position for overall and month balance on day view
- Enhancement: [#333] Adding start date for overall balance on preferences
- Enhancement: [#357] Adding flexible table format for month calendar with variable number of entries per day
- Enhancement: [#369] Adding flexible table format for day calendar as well
- Enhancement: [#383] Add system default theme that auto-detect if dark or light mode is set


Who built 1.5.6:

- thamara
Expand Down
246 changes: 245 additions & 1 deletion css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ body {
}

.error-tr {
border-bottom: 2px solid var(--error);
border-bottom: 2px solid var(--error) !important;
}

.title-header-text {
Expand Down Expand Up @@ -1025,3 +1025,247 @@ html[data-view='flexible'] #month-balance {
html[data-view='flexible'] #overall-balance {
width: 70px;
}

/** Flexible Day view related styles **/

html[data-view='flexible-day'] .title-header {
width: 100%;
margin-bottom: 80px;
}

html[data-view='flexible-day'] .title-header-text {
font-size: 300%;
}

html[data-view='flexible-day'] .table-header {
width: 100%;
}

html[data-view='flexible-day'] .th-month-name {
font-size: 115%;
}

html[data-view='flexible-day'] #calendar input[type="date" i]::-webkit-calendar-picker-indicator {
background-image: var(--day-calendar-select-icon);
height: 10px;
margin-left: 2px;
margin-right: -5px;
width: 10px;
}

html[data-view='flexible-day'] input[type="time" i]::-webkit-calendar-picker-indicator {
padding: 0;
margin: 0;
}

html[data-view='flexible-day'] #calendar-table-body {
width: 100%;
display: flex;
flex-direction: column;
margin-top: 10px;
}

html[data-view='flexible-day'] #calendar-table-body .th-label {
margin-top: auto;
margin-bottom: auto;
width: 30%;
}

html[data-view='flexible-day'] #calendar-table-body .first-group {
width: 30%;
text-align: center;
}

html[data-view='flexible-day'] #calendar-table-body .second-group {
width: 63%;
text-align: center;
}

@media (min-width: 768px) {
html[data-view='flexible-day'] #calendar-table-body .second-group {
width: 67%;
}
}

html[data-view='flexible-day'] #calendar-table-body .third-group {
width: 5%;
text-align: center;
}

html[data-view='flexible-day'] #calendar-table-body .rows-time {
display: flex;
flex-direction: column;
}

html[data-view='flexible-day'] #calendar-table-body .row-interval,
html[data-view='flexible-day'] #calendar-table-body .row-entry-pair,
html[data-view='flexible-day'] #calendar-table-body .row-controls {
display: inline-flex;
border-bottom: 1px solid var(--table-border);
width: 90% !important;
margin: auto;
padding: 2px 0 2px 0;
}

html[data-view='flexible-day'] #calendar-table-body .row-entry-pair input {
width: 100px;
text-align: center;
}

html[data-view='flexible-day'] #calendar-table-body .interval,
html[data-view='flexible-day'] .day-total-cell {
width: 80px;
margin: auto;
}

html[data-view='flexible-day'] .interval,
html[data-view='flexible-day'] .day-total-cell {
background-color: var(--table-cell-total-bground) !important;
color: var(--table-cell-total-color) !important;
text-align: center;
padding: 2px;
user-select: none;
height: 28px;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell {
text-align: center;
display: flex;
justify-content: space-evenly;
width: 24px;
user-select: none;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell .sign-container {
display: inline-block;
height: 24px;
overflow: hidden;
background-color: var(--table-cell-total-bground);
border-radius: 15px;
width: 25px;
cursor: pointer;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell .sign-container:hover {
background-color: var(--page-color);
transition: background-color 0.1s ease;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell span {
font-weight: bold;
font-size: 25px;
position: relative;
color: var(--page-bground);
}

html[data-view='flexible-day'] #calendar-table-body .row-total .third-group {
margin-top: 1px;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell .minus-sign {
top: -7px;
}

html[data-view='flexible-day'] #calendar-table-body .sign-cell .plus-sign {
top: -6px;
}

html[data-view='flexible-day'] .table-header tr {
border-bottom: 2px solid var(--punch-bground);
}

html[data-view='flexible-day'] .but-switch-view {
width: 6.5%;
}

html[data-view='flexible-day'] .table-body {
margin-top: 10px;
}

html[data-view='flexible-day'] .row-total {
display: inline-flex;
width: 90% !important;
margin: auto;
border-bottom: none !important;
padding: 10px 0 10px 0;
}

html[data-view='flexible-day'] .row-total .th {
margin: auto 0 auto 0;
}

html[data-view='flexible-day'] .row-waiver {
margin: auto;
padding: 2px 0 12px 0;
display: flex;
}

html[data-view='flexible-day'] .row-waiver .waived-day-text {
margin: auto 20px auto auto;
}

html[data-view='flexible-day'] .today-non-working {
border-bottom: none !important;
}

html[data-view='flexible-day'] .non-working-day {
background: none;
margin: auto auto 10px auto;
text-align: center;
}

html[data-view='flexible-day'] .summary {
padding: 5px 0 5px 0;
display: flex;
border-top: 4px solid var(--table-total-border);
border-bottom: none !important;
}

html[data-view='flexible-day'] .summary .leave-by-text {
margin: 2px 20px auto auto;
}

html[data-view='flexible-day'] .summary .leave-by-time {
margin-right: auto;
}

html[data-view='flexible-day'] .month-total-row {
width: 100%;
display: flex;
flex: auto;
flex-direction: row;
border-top: 4px solid var(--table-total-border);
border-bottom: none;
margin: auto;
padding: 5px 0 2px 0;
}

html[data-view='flexible-day'] .month-total-row .month-total-text {
padding-right: 10px;
text-align: right;
}

html[data-view='flexible-day'] .month-total-row .month-total-element {
margin-left: auto;
margin-right: auto;
display: flex;
width: fit-content;
}

html[data-view='flexible-day'] .month-total-row .month-total-time {
text-align: left;
}

html[data-view='flexible-day'] .footer {
height: 32px;
font-size: 100%;
}

html[data-view='flexible-day'] .footer .punch-button {
font-weight: 700;
font-family: 'Montserrat', sans-serif;
}

html[data-view='flexible-day'] .punch-button img {
display: none;
}
2 changes: 1 addition & 1 deletion js/classes/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {
displayWaiverWindow
} = require('../workday-waiver-aux.js');
const { computeAllTimeBalanceUntilAsync } = require('../time-balance.js');
const { generateKey } = require('../date-db-formatter');
const { generateKey } = require('../date-db-formatter.js');

// Global values for calendar
const store = new Store();
Expand Down
14 changes: 13 additions & 1 deletion js/classes/CalendarFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { getDefaultWidthHeight} = require('../user-preferences.js');
const { Calendar } = require('./Calendar.js');
const { FixedDayCalendar } = require('./FixedDayCalendar.js');
const { FlexibleMonthCalendar } = require('./FlexibleMonthCalendar.js');
const { FlexibleDayCalendar } = require('./FlexibleDayCalendar.js');

class CalendarFactory {
static getInstance(preferences, calendar = undefined) {
Expand Down Expand Up @@ -38,7 +39,18 @@ class CalendarFactory {
throw new Error(`Could not instantiate ${view}`);
}
else if (numberOfEntries === 'flexible') {
if (view === 'month') {
if (view === 'day') {
if (calendar === undefined || calendar.constructor.name !== 'FlexibleDayCalendar') {
if (calendar !== undefined && calendar.constructor.name !== 'FlexibleDayCalendar') {
ipcRenderer.send('RESIZE_MAIN_WINDOW', widthHeight.width, widthHeight.height);
}
return new FlexibleDayCalendar(preferences);
} else {
calendar.updatePreferences(preferences);
calendar.redraw();
return calendar;
}
} else if (view === 'month') {
if (calendar === undefined || calendar.constructor.name !== 'FlexibleMonthCalendar') {
if (calendar !== undefined && calendar.constructor.name !== 'FlexibleMonthCalendar') {
ipcRenderer.send('RESIZE_MAIN_WINDOW', widthHeight.width, widthHeight.height);
Expand Down
Loading

0 comments on commit 2776f98

Please sign in to comment.