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
commitf53768612b1e2268697b5444e502032ef9f3fb3c (patch)
tree4ed49b73e6bd3c2f8fceffa9643973033f87af95 /extension/react-app/src/redux/selectors
downloadsncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.gz
sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.bz2
sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.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 };