Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RichText Editor Component #681

Merged
merged 14 commits into from
May 2, 2024
2 changes: 2 additions & 0 deletions frontend/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"test": "echo \"Woah there, we have no frontend tests as of right now. Let's just say we're passing.\" && exit 0"
},
"dependencies": {
"@blocknote/core": "^0.12.4",
"@blocknote/react": "^0.12.4",
"@reduxjs/toolkit": "^2.2.3",
"next": "14.2.3",
"react": "^18",
Expand Down
14 changes: 1 addition & 13 deletions frontend/dashboard/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
@tailwind components;
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
Expand All @@ -17,13 +11,7 @@
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
margin: 0,
}

@layer utilities {
Expand Down
18 changes: 11 additions & 7 deletions frontend/dashboard/src/store/StoreProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
"use client";
'use client'

import { useRef } from "react";
import { AppStore, makeStore } from "./store";
import { Provider } from "react-redux";

type StoreProviderProps = {
children: React.ReactNode;
};
}

/**
* The Redux store provider component. This makes the store accessible globally across the repository
*/
export default function StoreProvider({ children }: StoreProviderProps) {
const storeRef = useRef<AppStore>();

// Instantiate store singleton:
if (!storeRef.current) {
storeRef.current = makeStore();
}
return <Provider store={storeRef.current}>{children}</Provider>;
// Instantiate store singleton:
if (!storeRef.current) {
storeRef.current = makeStore()
}
return (
<Provider store={storeRef.current}>
{children}
</Provider>
)
}
23 changes: 12 additions & 11 deletions frontend/dashboard/src/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { configureStore } from "@reduxjs/toolkit";
import { useDispatch, useSelector, useStore } from "react-redux";
import { baseApi } from "@sac/lib";
import { configureStore } from '@reduxjs/toolkit'
import { useDispatch, useSelector, useStore } from 'react-redux';
import { baseApi } from '@sac/lib';

export const makeStore = () => {
return configureStore({
Expand All @@ -9,16 +9,17 @@ export const makeStore = () => {
},

middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(baseApi.middleware),
});
getDefaultMiddleware()
.concat(baseApi.middleware)
})
};

// Redux types:
export type AppStore = ReturnType<typeof makeStore>;
export type RootState = ReturnType<AppStore["getState"]>;
export type AppDispatch = AppStore["dispatch"];
export type AppStore = ReturnType<typeof makeStore>
export type RootState = ReturnType<AppStore['getState']>
export type AppDispatch = AppStore['dispatch']

// Typed Redux interactive methods:
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
export const useAppSelector = useSelector.withTypes<RootState>();
export const useAppStore = useStore.withTypes<AppStore>();
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
export const useAppSelector = useSelector.withTypes<RootState>()
export const useAppStore = useStore.withTypes<AppStore>()
Loading
Loading