chore: IDB_CONNECTION_READY action

This commit is contained in:
Anoop M D 2022-02-03 23:25:38 +05:30
parent 87907eeb53
commit ac7d5c04a3
4 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { IconCode, IconStack, IconGitPullRequest, IconUser, IconUsers, IconSettings, IconLayoutGrid } from '@tabler/icons'; import { IconCode, IconStack, IconGitPullRequest, IconUser, IconUsers, IconSettings, IconLayoutGrid, IconBuilding } from '@tabler/icons';
import StyledWrapper from './StyledWrapper'; import StyledWrapper from './StyledWrapper';
const MenuBar = () => { const MenuBar = () => {
@ -23,6 +23,10 @@ const MenuBar = () => {
</div> </div>
</div> </div>
<div className="flex flex-col flex-grow justify-end"> <div className="flex flex-col flex-grow justify-end">
{/* Teams Icon */}
{/* <div className="menu-item">
<IconBuilding size={28} strokeWidth={1.5}/>
</div> */}
<div className="menu-item"> <div className="menu-item">
<IconUser size={28} strokeWidth={1.5}/> <IconUser size={28} strokeWidth={1.5}/>
</div> </div>

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'; import React, { useEffect } from 'react';
import Mousetrap from 'mousetrap'; import Mousetrap from 'mousetrap';
export const HotkeysContext = React.createContext(); export const HotkeysContext = React.createContext();
@ -17,7 +17,7 @@ export const HotkeysProvider = props => {
}, []); }, []);
return ( return (
<HotkeysContext.Provider {...props}> <HotkeysContext.Provider {...props} value='hotkey'>
{props.children} {props.children}
</HotkeysContext.Provider> </HotkeysContext.Provider>
); );

View File

@ -1,12 +1,11 @@
import React, { useEffect, useContext, useReducer, createContext } from 'react'; import React, { useEffect, useContext, useReducer, createContext } from 'react';
import reducer from './reducer'; import reducer from './reducer';
import useIdb from './useIdb';
import { sendRequest } from '../../network'; import { sendRequest } from '../../network';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
export const StoreContext = createContext(); export const StoreContext = createContext();
const tabId1 = nanoid();
const collection = { const collection = {
"id": nanoid(), "id": nanoid(),
"name": "spacex", "name": "spacex",
@ -112,6 +111,7 @@ const collection2 = {
}; };
const initialState = { const initialState = {
idbConnection: null,
collections: [collection, collection2], collections: [collection, collection2],
activeRequestTabId: null, activeRequestTabId: null,
requestQueuedToSend: null, requestQueuedToSend: null,
@ -132,6 +132,8 @@ export const StoreProvider = props => {
} }
}, [state.requestQueuedToSend]); }, [state.requestQueuedToSend]);
useIdb(dispatch);
return <StoreContext.Provider value={[state, dispatch]} {...props} />; return <StoreContext.Provider value={[state, dispatch]} {...props} />;
}; };

View File

@ -15,6 +15,14 @@ import {
const reducer = (state, action) => { const reducer = (state, action) => {
switch (action.type) { switch (action.type) {
case actions.IDB_CONNECTION_READY: {
return produce(state, (draft) => {
draft.idbConnection = action.connection;
console.log("here");
});
}
case actions.SIDEBAR_COLLECTION_CLICK: { case actions.SIDEBAR_COLLECTION_CLICK: {
return produce(state, (draft) => { return produce(state, (draft) => {
const collection = find(draft.collections, (c) => c.id === action.id); const collection = find(draft.collections, (c) => c.id === action.id);