zhixiangteoh / retrospective-tracker Goto Github PK
View Code? Open in Web Editor NEWBrowser extension designed to conveniently create and track weekly retrospectives for the MLH Fellowship.
License: MIT License
Browser extension designed to conveniently create and track weekly retrospectives for the MLH Fellowship.
License: MIT License
Features
Following this React Browser Todo List Extension
User should be able to edit and/or delete list item(s) as required.
Changes required to achieve this:
Current
(so that the current items can eventually be ordered by date/week in Previous
page)ListContext
)
added
fieldPrevious
page's dropdown lists UIPrevious
page with current week's list on local Monday 0000H and refresh Current
Retrospective-Tracker
Browser extension designed to conveniently create and track weekly retrospectives for the MLH Fellowship.
Current | Previous | Action Items
Green | Yellow | Red
Current | Previous | Action Items
Dropdown list ordered by weeks, ordered latest to earliest
Current | Previous | Action Items
Core features:
Additional features (in no order):
currentMonday
in browser storageStart New Week
handler to only accept max one week into futureMain Menu:
Refresh Current
, update PreviousList
accordingly.
Basic idea:
Use React Context and browser
s' storage API, with browser
polyfilled using webextension-polyfill
node module.
Find below code highlighting some key details
(taken from framer demo extension):
// import React, { useReducer, useEffect, useRef } from 'react';
import browser from 'webextension-polyfill'; // browser polyfill to access `browser` generically
// import getStubData from './getStubData';
// ... import actions
const TodoContext = React.createContext([]); // create React Context for app-wide storage
const reducer = (state, { payload, type }) => {
// ... action-reducer stuff
};
const TodoProvider = ({ children }) => {
const [state, dispatch] = useReducer(reducer, []);
const initRef = useRef(false);
// Sync with storage
useEffect(() => {
if (initRef.current) {
browser.storage.sync.set({ list: state }); // here, list: key, state: value
// Update badge counter
browser.runtime.sendMessage({
greeting: 'updateBadge',
text: state.filter(({ isDone }) => !isDone).length.toString(),
});
}
}, [state]);
// Listen to storage change and update the list
useEffect(() => {
browser.storage.onChanged.addListener(changes => {
if (changes.list) {
dispatch({ type: INIT, payload: changes.list.newValue });
}
});
}, []);
// Initialize the list with saved items or with initial data
useEffect(async () => {
const { list } = await browser.storage.sync.get({ list: getStubData() });
dispatch({ type: INIT, payload: list });
initRef.current = true;
}, []);
return <TodoContext.Provider value={[state, dispatch]}>{children}</TodoContext.Provider>;
};
export { TodoProvider, TodoContext };
Note:
When using storage.sync, the stored data will automatically be synced to any Chrome browser that the user is logged into, provided the user has sync enabled.
When Chrome is offline, Chrome stores the data locally. The next time the browser is online, Chrome syncs the data. Even if a user disables syncing, storage.sync will still work. In this case, it will behave identically to storage.local.
This is good; for the purposes of this project we can go ahead and use browser storage API.
Schema:
// e.g. actions object in browser storage
actions = {
greenItems: null,
yellowItems: [
{ id: "1", body: "need to fix" },
{ id: "2", body: "could've improved"},
...
],
redItems: [
{ id: "3", body: "failed to fix" },
{ id: "4", body: "failure in life"},
...
]
}
Reducer to support these actions:
yellowItems
)redItems
)yellowItems
by id
)redItems
by id
)yellowItems
array)redItems
array)actions
object)How it will generally work:
currentMonday
firstMonday
and dispatches INIT
Move to Green/Yellow/Red
REMOVE_YELLOW_ITEM
/ REMOVE_RED_ITEM
from Actions contextADD_YELLOW_ITEM
/ ADD_RED_ITEM
to Current's List contextDelete
REMOVE_YELLOW_ITEM
/ REMOVE_RED_ITEM
from Actions contextUpdate: Decided to reuse ListContext
to create a pseudo Actions context, but with a null greenItems
field and without accessing / modifying this field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.