summaryrefslogtreecommitdiff
path: root/extension/react-app/src/redux/selectors
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-05-23 23:45:12 -0400
committerNate Sesti <sestinj@gmail.com>2023-05-23 23:45:12 -0400
commit27ecedb02ef79ce53bf533e016b00462c44541be (patch)
tree402305113b6f04c3e3b3563b68d32de5ff1c69c8 /extension/react-app/src/redux/selectors
downloadsncontinue-27ecedb02ef79ce53bf533e016b00462c44541be.tar.gz
sncontinue-27ecedb02ef79ce53bf533e016b00462c44541be.tar.bz2
sncontinue-27ecedb02ef79ce53bf533e016b00462c44541be.zip
copying from old repo
Diffstat (limited to 'extension/react-app/src/redux/selectors')
-rw-r--r--extension/react-app/src/redux/selectors/chatSelectors.ts11
-rw-r--r--extension/react-app/src/redux/selectors/debugContextSelectors.ts29
-rw-r--r--extension/react-app/src/redux/selectors/miscSelectors.ts5
3 files changed, 45 insertions, 0 deletions
diff --git a/extension/react-app/src/redux/selectors/chatSelectors.ts b/extension/react-app/src/redux/selectors/chatSelectors.ts
new file mode 100644
index 00000000..51e8a636
--- /dev/null
+++ b/extension/react-app/src/redux/selectors/chatSelectors.ts
@@ -0,0 +1,11 @@
+import { RootStore } from "../store";
+
+const selectChatMessages = (state: RootStore) => {
+ return state.chat.messages;
+};
+
+const selectIsStreaming = (state: RootStore) => {
+ return state.chat.isStreaming;
+};
+
+export { selectChatMessages, selectIsStreaming };
diff --git a/extension/react-app/src/redux/selectors/debugContextSelectors.ts b/extension/react-app/src/redux/selectors/debugContextSelectors.ts
new file mode 100644
index 00000000..89201bb7
--- /dev/null
+++ b/extension/react-app/src/redux/selectors/debugContextSelectors.ts
@@ -0,0 +1,29 @@
+import { RootStore } from "../store";
+
+const selectDebugContext = (state: RootStore) => {
+ return {
+ ...state.debugState.debugContext,
+ rangesInFiles: state.debugState.debugContext.rangesInFiles.filter(
+ (_, index) => state.debugState.rangesMask[index]
+ ),
+ };
+};
+
+const selectAllRangesInFiles = (state: RootStore) => {
+ return state.debugState.debugContext.rangesInFiles;
+};
+
+const selectRangesMask = (state: RootStore) => {
+ return state.debugState.rangesMask;
+};
+
+const selectDebugContextValue = (state: RootStore, key: string) => {
+ return (state.debugState.debugContext as any)[key];
+};
+
+export {
+ selectDebugContext,
+ selectDebugContextValue,
+ selectAllRangesInFiles,
+ selectRangesMask,
+};
diff --git a/extension/react-app/src/redux/selectors/miscSelectors.ts b/extension/react-app/src/redux/selectors/miscSelectors.ts
new file mode 100644
index 00000000..7dbaed09
--- /dev/null
+++ b/extension/react-app/src/redux/selectors/miscSelectors.ts
@@ -0,0 +1,5 @@
+import { RootStore } from "../store";
+
+const selectHighlightedCode = (state: RootStore) => state.misc.highlightedCode;
+
+export { selectHighlightedCode };