Skip to content

Commit

Permalink
Merge pull request #6991 from AugurProject/auto-fill-template-categories
Browse files Browse the repository at this point in the history
add ability to fill in categories based on templates that don't have …
  • Loading branch information
mergify[bot] committed Mar 28, 2020
2 parents 96dc4a4 + e3d1f40 commit 67079bd
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/augur-artifacts/src/templates.ts

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions packages/augur-tools/src/templates-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_PGA_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -142,6 +143,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_PGA_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -197,6 +199,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_PGA_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -295,6 +298,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_EURO_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -336,6 +340,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_EURO_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -391,6 +396,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_EURO_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -489,6 +495,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_LPGA_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -530,6 +537,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_LPGA_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -562,6 +570,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.GOLF_LPGA_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -886,6 +895,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.HOCKEY_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -1018,6 +1028,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.HORSE_RACING_EVENT,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -1047,6 +1058,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.HORSE_RACING_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -1747,6 +1759,7 @@ export const TEMPLATES = {
inputDestIds: [1, 2],
values: LIST_VALUES.SOCCER_LEAGUES,
inputDestValues: SOCCER_LEAGUE_DEP_TEAMS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -1820,6 +1833,7 @@ export const TEMPLATES = {
inputDestIds: [1, 3],
values: LIST_VALUES.SOCCER_LEAGUES,
inputDestValues: SOCCER_LEAGUE_DEP_TEAMS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -1894,6 +1908,7 @@ export const TEMPLATES = {
inputDestIds: [1, 2],
values: LIST_VALUES.SOCCER_LEAGUES,
inputDestValues: SOCCER_LEAGUE_DEP_TEAMS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -2512,6 +2527,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.BASKETBALL_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -3403,6 +3419,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.NCAA_BASKETBALL_EVENTS,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -3735,6 +3752,7 @@ export const TEMPLATES = {
inputDestIds: [0],
values: LIST_VALUES.BASEBALL_EVENT,
inputDestValues: BASEBALL_EVENT_DEP_TEAMS,
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -3937,6 +3955,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.BASEBALL_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -4062,6 +4081,7 @@ export const TEMPLATES = {
inputDestIds: [2],
values: LIST_VALUES.OLYMPIC_SUMMER_SPORTS,
inputDestValues: OLYMPIC_SUMMER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4101,6 +4121,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Sport`,
values: LIST_VALUES.OLYMPIC_SUMMER_SPORTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4147,6 +4168,7 @@ export const TEMPLATES = {
inputDestIds: [3],
values: LIST_VALUES.OLYMPIC_SUMMER_SPORTS,
inputDestValues: OLYMPIC_SUMMER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4202,6 +4224,7 @@ export const TEMPLATES = {
inputDestIds: [3],
values: LIST_VALUES.OLYMPIC_SUMMER_SPORTS,
inputDestValues: OLYMPIC_SUMMER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4297,6 +4320,7 @@ export const TEMPLATES = {
inputDestIds: [1],
values: LIST_VALUES.OLYMPIC_SUMMER_SPORTS,
inputDestValues: OLYMPIC_SUMMER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4392,6 +4416,7 @@ export const TEMPLATES = {
inputDestIds: [2],
values: LIST_VALUES.OLYMPIC_WINTER_SPORTS,
inputDestValues: OLYMPIC_WINTER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4431,6 +4456,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Sport`,
values: LIST_VALUES.OLYMPIC_WINTER_SPORTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4477,6 +4503,7 @@ export const TEMPLATES = {
inputDestIds: [3],
values: LIST_VALUES.OLYMPIC_WINTER_SPORTS,
inputDestValues: OLYMPIC_WINTER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4532,6 +4559,7 @@ export const TEMPLATES = {
inputDestIds: [3],
values: LIST_VALUES.OLYMPIC_WINTER_SPORTS,
inputDestValues: OLYMPIC_WINTER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -4627,6 +4655,7 @@ export const TEMPLATES = {
inputDestIds: [1],
values: LIST_VALUES.OLYMPIC_WINTER_SPORTS,
inputDestValues: OLYMPIC_WINTER_SPORT_EVENTS,
categoryDestId: 2,
},
{
id: 1,
Expand Down Expand Up @@ -5157,6 +5186,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.FOOTBALL_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -5663,6 +5693,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.NCAA_FOOTBALL_EVENT,
categoryDestId: 2,
},
{
id: 2,
Expand Down Expand Up @@ -6672,6 +6703,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.ENTERTAINMENT_EVENT,
categoryDestId: 1,
},
],
resolutionRules: {
Expand Down Expand Up @@ -6723,6 +6755,7 @@ export const TEMPLATES = {
inputDestIds: [1],
values: LIST_VALUES.ENTERTAINMENT_EVENT,
inputDestValues: ENTERTAINMENT_EVENT_DEP_TEAMS,
categoryDestId: 1,
},
],
resolutionRules: {
Expand Down Expand Up @@ -6871,6 +6904,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Event`,
values: LIST_VALUES.ENTERTAINMENT_EVENT,
categoryDestId: 1,
},
{
id: 2,
Expand Down Expand Up @@ -6920,6 +6954,7 @@ export const TEMPLATES = {
inputDestIds: [0],
values: LIST_VALUES.ENTERTAINMENT_EVENT,
inputDestValues: ENTERTAINMENT_EVENT_DEP_TEAMS,
categoryDestId: 1,
},
{
id: 3,
Expand Down Expand Up @@ -6971,6 +7006,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7023,6 +7059,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7064,6 +7101,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7114,6 +7152,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7166,6 +7205,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7207,6 +7247,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7257,6 +7298,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7309,6 +7351,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7350,6 +7393,7 @@ export const TEMPLATES = {
defaultLabel: `Select Pair First`,
placeholder: `Market Source`,
values: [],
categoryDestId: 2,
},
],
resolutionRules: {
Expand Down Expand Up @@ -7394,6 +7438,7 @@ export const TEMPLATES = {
type: TemplateInputType.DROPDOWN,
placeholder: `Countries`,
values: LIST_VALUES.MEDICAL_COUNTRIES,
categoryDestId: 1,
},
{
id: 3,
Expand Down
3 changes: 3 additions & 0 deletions packages/augur-ui/src/modules/common/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export const determineVisible = (
primaryOptions: NameValuePair[],
secondaryOptions: NameValuePair[],
tertiaryOptions: NameValuePair[],
disableSubCategory: boolean,
disabledTertiary: boolean,
selected: string[]
) => {
Expand All @@ -387,6 +388,7 @@ export const determineVisible = (
const customSecondary =
selected[1] === CUSTOM ||
(selected[1] &&
!disableSubCategory &&
!secondaryOptions.map(option => option.value).includes(selected[1])) ||
(!showSecondaryDropdown && customPrimary && values[0] !== '');
const customTertiary =
Expand Down Expand Up @@ -663,6 +665,7 @@ export class CategoryMultiSelect extends Component<
primaryOptions,
secondaryOptions,
tertiaryOptions,
disableSubCategory,
disableTertiaryCategory,
selected
);
Expand Down
Loading

0 comments on commit 67079bd

Please sign in to comment.