1import React, { createContext, useContext, forwardRef } from 'react';
3import useHostingStore from './lib/useHostingStore';
5import { NETWORK_TYPES } from '../lib/network';
7import { useNetwork } from 'store/network';
9export const HostingContext = createContext(null);
11const HOSTING_DETAILS = {
12 DEV: { url: '', domain: 'liam.tlon.network', disabled: true },
13 MAINNET: { url: '', domain: '', disabled: true },
16export function HostingProvider({ children }) {
17 const { networkType } = useNetwork();
18 const { url, domain, disabled } =
19 networkType === NETWORK_TYPES.MAINNET
20 ? HOSTING_DETAILS.MAINNET
21 : HOSTING_DETAILS.DEV;
22 const store = useHostingStore(url, domain, disabled);
24 <HostingContext.Provider value={store}>{children}</HostingContext.Provider>
28export function useHosting() {
29 return useContext(HostingContext);
32export const withHosting = Component =>
33 forwardRef((props, ref) => (
34 <HostingContext.Consumer>
35 {store => <Component ref={ref} {...store} {...props} />}
36 </HostingContext.Consumer>
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list