Skip to content

Commit

Permalink
Merge pull request #12 from oslabs-beta/RachTeoFrontendTS
Browse files Browse the repository at this point in the history
AppStateSlice TS Converted no errors
  • Loading branch information
rachelk585 authored May 1, 2023
2 parents 1aa2988 + f9c7936 commit e0c5734
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/src/helperFunctions/manageSeparators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const separator = {
const manageSeparators: ManageSeparators = {
nextTopSeparatorId: 1000,
// this function checks for two separators in a row or missing separators and adds/removes as needed
handleSeparators: (arr: ChildElement[], str?) => {
handleSeparators: (arr, str) => {
if (
(str === 'delete' || str === 'change position') &&
arr.length === 1 &&
Expand Down Expand Up @@ -73,7 +73,7 @@ const manageSeparators: ManageSeparators = {
},

// this function replaces separators onto which an element is dropped with the element itself
mergeSeparator: (arr: ChildElement[], index: number) => {
mergeSeparator: (arr, index) => {
return arr.map((child) => {
// Added additional nested types for lists
if (
Expand Down
24 changes: 19 additions & 5 deletions app/src/interfaces/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export interface ChildElement {
name: string;
childId: number;
style: object;
attributes: object;
attributes: Attributes;
events: object;
children?: ChildElement[];
stateProps: StateProp[]; // state: [ { id, key, value, type }, ...]
stateUsed?: object;
stateUsed?: StateUsed;
passedInProps: StateProp[];
}

Expand All @@ -46,7 +46,7 @@ export interface Component {
useStateCodes: string[];
useContext?: object;
passedInProps: StateProp[];
stateUsed?: object;
stateUsed?: StateUsed;
}
export interface StateProp {
id: string;
Expand Down Expand Up @@ -107,7 +107,21 @@ export interface AddRoutes {
}

export interface ManageSeparators {
mergeSeparator: (arg1:any, arg2:any) => any; // update specificity
handleSeparators: (arg1: any, arg2?: any) => any; // update specificity
mergeSeparator: (arg1:ChildElement[], arg2?:number) => any; // update specificity
handleSeparators: (arg1: ChildElement[], arg2?: string) => number;
nextTopSeparatorId: number
}

export interface StateUsed {
compTextProviderId: number;
compTextPropsId: number;
compText: string;
compLinkProviderId: number;
compLinkPropsId: number;
compLink: string;
}

export interface Attributes {
compText?: string;
compLink?: string;
}
2 changes: 1 addition & 1 deletion app/src/redux/reducers/slice/appStateSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ export const {
deletePassedInProps,
deleteState,
toggleLoggedIn,
configToggle,
//configToggle,
snapShotAction,
allCooperativeState
} = appStateSlice.actions;
Expand Down
2 changes: 1 addition & 1 deletion app/src/redux/reducers/slice/contextReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
interface Context {
name: string;
values: Array<{ key: string; value: string }>;
components: Array<string>;
components: string[];
}

interface AddContextPayload {
Expand Down

0 comments on commit e0c5734

Please sign in to comment.