mirror of
https://github.com/wassname/talk.git
synced 2026-08-06 13:41:02 +08:00
Add UserBox
This commit is contained in:
@@ -4,3 +4,6 @@
|
||||
|
||||
export const NETWORK_TYPE = "Network";
|
||||
export const NETWORK_ID = "client:root.local.network";
|
||||
|
||||
export const AUTH_POPUP_TYPE = "AuthPopup";
|
||||
export const AUTH_POPUP_ID = "client:root.local.authPopup";
|
||||
|
||||
@@ -7,7 +7,12 @@ import {
|
||||
LOCAL_TYPE,
|
||||
} from "talk-framework/lib/relay";
|
||||
|
||||
import { NETWORK_ID, NETWORK_TYPE } from "./constants";
|
||||
import {
|
||||
AUTH_POPUP_ID,
|
||||
AUTH_POPUP_TYPE,
|
||||
NETWORK_ID,
|
||||
NETWORK_TYPE,
|
||||
} from "./constants";
|
||||
|
||||
/**
|
||||
* Initializes the local state, before we start the App.
|
||||
@@ -18,6 +23,7 @@ export default async function initLocalState(environment: Environment) {
|
||||
|
||||
// Create the Local Record which is the Root for the client states.
|
||||
const localRecord = createAndRetain(environment, s, LOCAL_ID, LOCAL_TYPE);
|
||||
root.setLinkedRecord(localRecord, "local");
|
||||
|
||||
// Parse query params
|
||||
const query = qs.parse(location.search);
|
||||
@@ -47,6 +53,17 @@ export default async function initLocalState(environment: Environment) {
|
||||
);
|
||||
networkRecord.setValue(false, "isOffline");
|
||||
localRecord.setLinkedRecord(networkRecord, "network");
|
||||
root.setLinkedRecord(localRecord, "local");
|
||||
|
||||
// Create authPopup Record
|
||||
const authPopupRecord = createAndRetain(
|
||||
environment,
|
||||
s,
|
||||
AUTH_POPUP_ID,
|
||||
AUTH_POPUP_TYPE
|
||||
);
|
||||
authPopupRecord.setValue(false, "open");
|
||||
authPopupRecord.setValue(false, "focus");
|
||||
authPopupRecord.setValue("", "href");
|
||||
localRecord.setLinkedRecord(authPopupRecord, "authPopup");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,11 +3,24 @@ type Network {
|
||||
isOffline: Boolean!
|
||||
}
|
||||
|
||||
enum View {
|
||||
SIGN_UP
|
||||
SIGN_IN
|
||||
FORGOT_PASSWORD
|
||||
}
|
||||
|
||||
type AuthPopup {
|
||||
open: Boolean!
|
||||
focus: Boolean!
|
||||
view: View
|
||||
}
|
||||
|
||||
type Local {
|
||||
network: Network!
|
||||
assetID: String
|
||||
commentID: String
|
||||
assetURL: String
|
||||
commentID: String
|
||||
authPopup: AuthPopup!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
|
||||
Reference in New Issue
Block a user