Skip to content

Commit

Permalink
Merge pull request #266 from Shabang-Systems/feat-settingsv3
Browse files Browse the repository at this point in the history
Settings, Keybinds, and Keybord-Nav UI Version 3

co-authored-by: TheEnquirer <[email protected]>
  • Loading branch information
Jemoka and TheEnquirer authored Sep 18, 2022
2 parents 6b0c8da + b2cece4 commit f138fd6
Show file tree
Hide file tree
Showing 56 changed files with 8,517 additions and 2,989 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ ionic.config.json

*.jks
playstore_creds.json
/.log/
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
run:
yarn ionic:runserver
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
"name": "Condution",
"version": "1.2.0",
"dependencies": {
"@babel/helper-string-parser": "^7.18.10",
"@capacitor-community/electron": "^3.0.1",
"@capacitor/android": "^3.0.2",
"@capacitor/browser": "^1.0.2",
"@capacitor/core": "^3.3.4",
"@capacitor/filesystem": "^1.0.2",
"@capacitor/haptics": "^1.0.2",
"@capacitor/ios": "^3.0.2",
"@capacitor/preferences": "^4.0.1",
"@capacitor/storage": "^1.0.2",
"@ionic/core": "^5.6.10",
"@ionic/react": "^5.6.10",
Expand All @@ -31,12 +33,18 @@
"electron-updater": "^4.3.9",
"firebase": "^8.6.8",
"install": "^0.13.0",
"ionic": "^5.4.16",
"ionicons": "^5.5.2",
"jquery": "^3.5.1",
"kbar": "^0.1.0-beta.36",
"mousetrap": "^1.6.5",
"mousetrap-global-bind": "^1.1.0",
"mousetrap-record": "^1.0.1",
"nanoid": "^4.0.0",
"node-polyfill-webpack-plugin": "^2.0.0",
"node-sass": "^6.0.1",
"normalize-url": "^4.5.1",
"path-browserify": "^1.0.1",
"react": "17",
"react-beautiful-dnd": "^13.0.0",
"react-bootstrap": "^1.6.1",
Expand All @@ -45,6 +53,8 @@
"react-dom": "^17.0.2",
"react-getscreen": "^1.1.3",
"react-input-autosize": "^3.0.0",
"react-input-shortcut": "^0.0.1",
"react-keybind": "^0.9.4",
"react-localization": "^1.0.17",
"react-lottie": "^1.2.3",
"react-outside-click-handler": "^1.3.0",
Expand All @@ -53,6 +63,7 @@
"react-router-dom": "^5.1.2",
"react-scripts": "^4.0.3",
"react-select": "^4.3.1",
"react-shortcut-picker": "^1.3.1",
"react-spring": "8.0.25",
"react-tagsinput": "^3.19.0",
"react-tooltip": "^4.2.21",
Expand Down Expand Up @@ -105,7 +116,9 @@
"@typescript-eslint/parser": "^4.28.0",
"electron": "^13.1.4",
"electron-builder": "^22.11.7",
"electron-notarize": "^1.0.0"
"electron-notarize": "^1.0.0",
"eslint-config-react": "^1.1.7",
"eslint-config-react-app": "^7.0.1"
},
"description": "Tasks? Done. That was quick.",
"build": {
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Condution" />
<meta name="color-scheme" content="light dark" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
Expand Down
10 changes: 6 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import './themefiles/condutiontheme-default-adapter.css';
import './themefiles/condutiontheme-default.css';
import './themefiles/condutiontheme-default-dark.css';
import './themefiles/condutiontheme-default-light.css';
//import './themefiles/condutiontheme-default-new.css';
import './themefiles/condutiontheme-black-n-red.css';

/* Font awesome */
Expand All @@ -38,6 +37,9 @@ import './theme/variables.css';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { Storage } from '@capacitor/storage';

/* Keybinds! */
import { withShortcut, ShortcutProvider, ShortcutConsumer } from './static/react-keybind'

import $ from "jquery";

/* Our Lovley Core Engine */
Expand Down Expand Up @@ -413,10 +415,10 @@ class App extends Component {
case "firebase":
case "json":
case "portjson":
return <Home cm={this.cm} dispatch={this.authDispatch} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode}/>;
return <ShortcutProvider> <Home cm={this.cm} dispatch={this.authDispatch} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode}/> </ShortcutProvider>;
//email={firebase.auth().currentUser.email}
case "workspace":
return <Home cm={this.cm} dispatch={this.authDispatch} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode} workspace={this.state.workspace}/>;
return <ShortcutProvider> <Home cm={this.cm} dispatch={this.authDispatch} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode} workspace={this.state.workspace}/> </ShortcutProvider>;
//return <Home engine={Engine} uid={this.state.uid} dispatch={this.authDispatch} gruntman={this.gruntman} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode} workspace={this.state.workspace}/>;
case "json":
//return <Home engine={Engine} uid={this.state.uid} dispatch={this.authDispatch} gruntman={this.gruntman} displayName={this.state.displayName} localizations={this.state.localizations} authType={this.state.authMode}/>;
Expand All @@ -435,7 +437,7 @@ class App extends Component {
}
}

export default App;
export default withShortcut(App);
//class App extends Component {
//render() {
//return (
Expand Down
2 changes: 1 addition & 1 deletion src/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<div id="center">
<h1 style="margin:0; font-size: 24px; padding-bottom: 6px"><t style="font-weight: 300;padding-right: 3px;">#!/Shabang</t> <b style="color:#434d5f;">Condution</b></h1>
<t style="font-size: 15px; font-weight: 600; padding-right: 10px;">Tasks? Done. That was simple.</t>
<t style="font-size: 12px; font-weight: 300"><b>snow crash</b> v1.2.0_build4_M</t>
<t style="font-size: 12px; font-weight: 300"><b>snow crash</b> v1.2.0_build0_M</t>
<br />
<br />
<br />
Expand Down
2 changes: 1 addition & 1 deletion src/backend
105 changes: 69 additions & 36 deletions src/pages/Calendar.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IonContent, IonPage, IonSplitPane, IonMenu, IonText, IonIcon, IonMenuButton, IonRouterOutlet, IonMenuToggle, isPlatform } from '@ionic/react';
//import { chevronForwardCircle, checkmarkCircle, filterOutline, listOutline, bicycle } from 'ionicons/icons';
import React, { Component, useState, useEffect } from 'react';
import React, { Component, useState, useEffect, useRef } from 'react';
import {withGetScreen} from 'react-getscreen'
import './Calendar.css'
import './Pages.css';
Expand All @@ -12,6 +12,8 @@ import { Query } from "../backend/src/Objects/Utils.ts";
import T from "../backend/src/Objects/Task.ts";
import CalendarPopover, { CalendarUnit } from './Components/CalendarPopover';
import CalendarTasklistPopover from './Components/CalendarTasklistPopover';
import { withShortcut, ShortcutProvider, ShortcutConsumer } from '../static/react-keybind'
import keybindHandler from "./Components/KeybindHandler"

const autoBind = require('auto-bind/react');

Expand Down Expand Up @@ -82,11 +84,26 @@ function CalPageBigOllendar(props) {
let [isPopoverShown, setIsPopoverShown] = useState(false);

let [shownList, setShownList] = useState([]);

Array.prototype.max = function() {
return Math.max.apply(null, this);
};

//Array.prototype.max = function() { // THIS POLLUTES THE PROTOTYPE. IT BREAKS LOOPING THROUGH THE KEYS.
// return Math.max.apply(null, this);
//};


const goRight = useRef(null);
const goLeft = useRef(null);

const navigateLeft = () => {
if (goLeft.current) {
goLeft.current.click()
}
}

const navigateRight = () => {
if (goRight.current) {
goRight.current.click()
}
}
let refresh = (async function() {
let map = new Map();
let names = new Map();
Expand Down Expand Up @@ -118,9 +135,10 @@ function CalPageBigOllendar(props) {
let nameList = Array.from(names.values());
let idList = Array.from(ids.values());
if (values.length > 0) {
let max = values.max();
const max = (arr) => arr.reduce((a, b) => { return Math.max(a, b) })
let val_max = max(values)
let style = getComputedStyle(document.body);
let hexes = values.map(e=>__util_calculate_gradient(style.getPropertyValue('--heatmap-darkest').trim().slice(1), style.getPropertyValue('--heatmap-lightest').trim().slice(1), e/max));
let hexes = values.map(e=>__util_calculate_gradient(style.getPropertyValue('--heatmap-darkest').trim().slice(1), style.getPropertyValue('--heatmap-lightest').trim().slice(1), e/val_max));
Array.from(map.keys()).forEach((e, i)=>{hm[e]={color:hexes[i], value:values[i], names:nameList[i], ids: idList[i]}});
}
setHeat(hm);
Expand All @@ -130,6 +148,29 @@ function CalPageBigOllendar(props) {
refresh();
},[dateSelected, refreshed]);

const { shortcut } = props
useEffect(async () => {

const { shortcut } = props

// let ks = await keybindSource;
if (props.allKeybinds !== null) {
const toUnbind = keybindHandler(props, [
[navigateRight, props.allKeybinds.Calendar['Next month'], 'Next month', 'Goes to the next month'],
[navigateLeft, props.allKeybinds.Calendar['Previous month'], 'Previous month', 'Goes to the previous month'],
])

return () => {
const { shortcut } = props
for (const i in toUnbind) { // this doesn't seem to be working?
shortcut.unregisterShortcut(toUnbind[i])
}
shortcut.unregisterShortcut(["h", "l", "ArrowLeft", "ArrowRight"]) // so i'll do it manually..
// TODO figure this one out
}
}
}, [props.allKeybinds])

return (
<div id="calendar-page-bigol-calendar-wrapper" style={{display: "inline-block", height: "85%", width: "95%", ...props.style}}>
<CalendarTasklistPopover uid={props.uid} cm={props.cm} isShown={isPopoverShown} onDidDismiss={()=>setIsPopoverShown(false)} list={shownList} localizations={props.localizations} currentDate={dateSelected}/>
Expand Down Expand Up @@ -173,14 +214,18 @@ function CalPageBigOllendar(props) {
)}
</div>
<div id="bigol-calendar-tools">
<a className="fas fa-caret-left calendar-button" onClick={()=>{
<a
ref={goLeft}
className="fas fa-caret-left calendar-button" onClick={()=>{
let date = new Date(firstDayMonth.getFullYear(), firstDayMonth.getMonth()-1, 1);
setDateSelected(date);
if (props.onDateSelected)
props.onDateSelected(date);

}}></a>
<a className="fas fa-caret-right calendar-button" onClick={()=>{
<a
ref={goRight}
className="fas fa-caret-right calendar-button" onClick={()=>{
let date = new Date(firstDayMonth.getFullYear(), firstDayMonth.getMonth()+1, 1);
setDateSelected(date);
if (props.onDateSelected)
Expand Down Expand Up @@ -224,11 +269,13 @@ class Calendar extends Component {
currentDate: (today), // new date
taskList: [],
popoverIsVisible: false,
keybinds: [],

};

this.updatePrefix = this.random();
this.repeater = React.createRef(); // what's my repeater? | i.. i dont know what this does...
this.calPageBigRef = React.createRef();

// AutoBind!
autoBind(this);
Expand All @@ -240,33 +287,13 @@ class Calendar extends Component {
this.setState({showEdit: false});
} // util func for hiding repeat

componentWillUnmount() {
}
componentWillUnmount() {}

async refresh() {}

async refresh() {
// projectDB.map(proj=>buildSelectString(proj));

//let endDate = new Date(this.state.currentDate);
//endDate.setHours(23,59,59,60);
//let taskList = await this.props.engine.db.selectTasksInRange(this.props.uid, this.state.currentDate, endDate);

//refreshed++;

//this.setState({
//possibleProjects: pPandT[0][0], // set the project stuff
//possibleTags: pPandT[1][0], // set the tag stuff
//possibleProjectsRev: pPandT[0][1], // set more projects stuff
//possibleTagsRev: pPandT[1][1], // set more tags stuff
//availability: avail, // set the avail
//projectSelects: projectList, // set the project list
//tagSelects: tagsList, // set the tag list
//projectDB, // and the project db
//taskList
//}); // once we finish, set the state
}

componentDidMount() {
this.refresh()
this.refresh()
}

random() { return (((1+Math.random())*0x10000)|0).toString(16)+"-"+(((1+Math.random())*0x10000)|0).toString(16);}
Expand Down Expand Up @@ -327,7 +354,14 @@ class Calendar extends Component {
this.setState({currentDate: d, taskList});
}).bind(this)}/>
else
return <CalPageBigOllendar localizations={this.props.localizations} uid={this.props.uid} cm={this.props.cm} availability={this.state.availability}/>
return <CalPageBigOllendar
localizations={this.props.localizations}
uid={this.props.uid}
cm={this.props.cm}
availability={this.state.availability}
{...this.props}
//ref={this.calPageBigRef} // not working
/>
})()}
{(()=>{
if (this.props.isMobile())
Expand All @@ -350,5 +384,4 @@ class Calendar extends Component {
)
}
}
export default withGetScreen(Calendar, {mobileLimit: 720, tabletLimit:768, shouldListenOnResize: true});

export default withShortcut(withGetScreen(Calendar, {mobileLimit: 720, tabletLimit:768, shouldListenOnResize: true}));
1 change: 0 additions & 1 deletion src/pages/Completed.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

.fetch-more { /* fetch more css */
/*border: 1px solid red;*/
font-size: 12px;
color: var(--completed-fetch-more-text);
padding-left: 17px;
Expand Down
Loading

0 comments on commit f138fd6

Please sign in to comment.