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

refactor: convert remaining class components into function components #138

Merged
merged 41 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1101764
refactor: turned Activities into a function component
stickyPiston Jul 6, 2024
bba137a
style: changed function definition for Activity
stickyPiston Jul 6, 2024
bbc80f5
fix: Activities does not halt state machine when there are no more
stickyPiston Jul 6, 2024
ec60ff0
refactor: turned Ad into a function component
stickyPiston Jul 6, 2024
265deef
style: changed function definitions for Commits and Team
stickyPiston Jul 6, 2024
83e6127
refactor: added redux store and added api slices
stickyPiston Jul 8, 2024
3bc93e0
refactor: create board messages api slice
stickyPiston Jul 8, 2024
ffa21a2
refactor: create api slice for quotes
stickyPiston Jul 9, 2024
5c3c596
refactor: added slice for state machine variables
stickyPiston Jul 9, 2024
00fb902
refactor: combined api slices based on api bases
stickyPiston Jul 9, 2024
1fe0ffb
refactor: create api folder to replace previous store folder
stickyPiston Jul 10, 2024
a25c2de
refactor: created github api slice
stickyPiston Jul 10, 2024
34f2968
refactor: move env.js out of helpers
stickyPiston Jul 10, 2024
cdc8b6c
refactor: create store folder and moved api into it
stickyPiston Jul 11, 2024
d85dd17
refactor: moved state machine logic into thunk
stickyPiston Jul 12, 2024
41fc0bd
refactor: create index.js for components + style fixes
stickyPiston Jul 12, 2024
ddf8ec1
docs: added little bit of docs to new functions
stickyPiston Jul 12, 2024
db0a7c8
chore: install typescript
stickyPiston Jul 21, 2024
08718a1
refactor: converted files to typescript
stickyPiston Jul 21, 2024
ccd5d72
chore: removed scroll-into-view dependency
stickyPiston Jul 21, 2024
928cced
refactor: moved reference to snow.ts from main.tsx to index.html
stickyPiston Aug 5, 2024
bc85a71
refactor: moved github endpoint logic into own functions
stickyPiston Aug 5, 2024
7e38a67
refactor: reworked exports from api slices
stickyPiston Aug 29, 2024
27eed9a
refactor: split state slice into quotes and screen slice
stickyPiston Aug 30, 2024
067fd40
refactor: list index based on id as opposed to index
stickyPiston Aug 30, 2024
d2c0534
fix: changed koala activity date to be stored as string in store
stickyPiston Aug 30, 2024
289be9c
tooling: introduced prettier and git hooks
stickyPiston Sep 1, 2024
7b7f9b0
fix: add js files to lint-staged
stickyPiston Sep 1, 2024
ae65c99
refactor: combined adIndex and activityIndex in screen reducer
stickyPiston Sep 2, 2024
08a8b14
docs: added docs to quotes slice
stickyPiston Sep 5, 2024
773200a
refactor: changed if-else constructions into early returns
stickyPiston Sep 20, 2024
bb89cd0
Merge branch 'refactor/function-components' into refactor/redux
stickyPiston Sep 20, 2024
7429a98
fix: changed broken reference to quote index in StateMachine
stickyPiston Sep 24, 2024
2762818
Merge branch 'refactor/redux' of github.com:svsticky/radio into refac…
stickyPiston Oct 1, 2024
e659a4f
Merge remote-tracking branch 'origin/refactor/typescript' into toolin…
stickyPiston Oct 1, 2024
9483240
tooling: ran formatter
stickyPiston Oct 1, 2024
80c9000
Merge branch 'master' of github.com:svsticky/radio into tooling/forma…
stickyPiston Oct 1, 2024
c409567
fix: change activities key into id
stickyPiston Oct 9, 2024
70f2191
Merge pull request #144 from svsticky/tooling/formatter-and-git-hooks
stickyPiston Oct 9, 2024
06c955d
Merge pull request #142 from svsticky/refactor/typescript
stickyPiston Oct 9, 2024
b8d00cf
Merge pull request #140 from svsticky/refactor/redux
stickyPiston Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: added slice for state machine variables
stickyPiston committed Jul 9, 2024
commit 5c3c59617a2a77f3dc35d879dcfe87446e81896c
4 changes: 3 additions & 1 deletion src/store.js
Original file line number Diff line number Diff line change
@@ -4,13 +4,15 @@ import activities from "./store/activities";
import ads from "./store/ads";
import boardMessages from "./store/boardMessages";
import quotes from "./store/quotes";
import state from "./store/state";

const store = configureStore({
reducer: {
[activities.reducerPath]: activities.reducer,
[ads.reducerPath]: ads.reducer,
[boardMessages.reducerPath]: boardMessages.reducer,
[quotes.reducerPath]: quotes.reducer
[quotes.reducerPath]: quotes.reducer,
state
},
middleware(getDefaultMiddleware) {
return getDefaultMiddleware()
34 changes: 34 additions & 0 deletions src/store/state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {createSlice} from "@reduxjs/toolkit";

const state = createSlice({
name: "state",
initialState: {
activityIndex: 0,
adIndex: 0,
boardMessageIndex: 0,
quotesIndices: []
},
reducers: {
incrementActivityIndex(state) {
state.activityIndex++;
},
incrementAdIndex(state) {
state.adIndex++;
},
incrementBoardMessageIndex(state) {
state.boardMessageIndex++;
},
shiftQuote(state, action) {
if (state.quotesIndices.length === 1) {
state.quotesIndices = new Array(action.payload)
.fill(0)
.map((_, i) => i);
} else {
state.quotesIndices.shift();
}
}
}
});

export const { incrementActivityIndex, incrementAdIndex, incrementBoardMessageIndex, shiftQuote } = state.actions;
export default state.reducer;