forked from mozilla/testpilot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @flow | ||
|
||
import type { | ||
Localizations, | ||
SetLocalizationsAction | ||
} from '../reducers/localizations.js'; | ||
|
||
export function updateExperiment(addonID: string, data: Experiment): UpdateExperimentAction { | ||
return { | ||
type: 'UPDATE_EXPERIMENT', | ||
payload: { addonID, data } | ||
}; | ||
} | ||
|
||
export function setLocalizations(localizations: Localizations): SetLocalizationsAction { | ||
console.log('setLocalizations', localizations); | ||
return { | ||
type: 'SET_LOCALIZATIONS', | ||
payload: localizations | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// @flow | ||
|
||
export type Localizations = { | ||
[language: string]: string | ||
}; | ||
|
||
function defaultState(): ExperimentsState { | ||
return { | ||
}; | ||
} | ||
|
||
export type SetLocalizationsAction = { | ||
type: 'SET_LOCALIZATIONS', | ||
payload: Localizations | ||
}; | ||
|
||
function setLocalizations( | ||
state: Localizations, | ||
action: SetLocalizationsAction | ||
): Localizations { | ||
return action.payload; | ||
} | ||
|
||
export default function experimentsReducer( | ||
state: ?Localizations, | ||
action: SetLocalizationsAction | ||
): Localizations { | ||
if (!state) { | ||
return defaultState(); | ||
} | ||
switch (action.type) { | ||
case 'SET_LOCALIZATIONS': | ||
return setLocalizations(state, action); | ||
default: | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters