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

Add country flag to Teams #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion configschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"steamApiKey": {
"type": "string",
"description": "Steam API key used to get steam profile pictures (https://steamcommunity.com/dev/apikey)",
"default": "STEAM-API-KEY"
"default": "D9A12350EB5284BDCC1FA72AD2EAE154"
},
"gameSettings": {
"type": "object",
Expand Down
34 changes: 15 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodecg-csgo-manager",
"version": "0.8.1",
"version": "0.8.2",
"description": "Layouts for CSGO spectating",
"homepage": "",
"author": {
Expand Down
15 changes: 14 additions & 1 deletion src/dashboard/setup/team-preset-creator/team-preset-creator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import styled from 'styled-components';
/* eslint-disable-next-line */
// @ts-ignore
// @ts-ignore
import Twemoji from 'react-twemoji';
import { render } from 'react-dom';
import { useListenFor, useReplicant } from 'use-nodecg';
Expand Down Expand Up @@ -51,6 +51,7 @@ export const TeamPresetCreator: React.FC = () => {
const [localName, setLocalName] = useState('');
const [localPfp, setLocalPfp] = useState('');
const [localCountry, setLocalCountry] = useState('');
const [localCountryTeam, setLocalCountryTeam] = useState('');
const [localLogo, setLocalLogo] = useState('');
const [localTeamName, setLocalTeamName] = useState('');
const [localTeamAlias, setLocalTeamAlias] = useState('');
Expand Down Expand Up @@ -174,6 +175,7 @@ export const TeamPresetCreator: React.FC = () => {
setLocalTeamAlias(foundTeamPreset.alias);
setLocalTeamName(foundTeamPreset.name);
setLocalLogo(foundTeamPreset.logo || '');
setLocalCountryTeam(foundTeamPreset.country || '');
}
}
}, [localTeamPresetAlias, teamPresetsRep.teams, localTeamName]);
Expand Down Expand Up @@ -201,13 +203,15 @@ export const TeamPresetCreator: React.FC = () => {
name: localTeamName,
alias: localTeamAlias,
logo: localLogo,
country: localCountryTeam
});

setSnackbarMsg(`Added ${localName}`);
setLocalTeamAlias('');
setLocalTeamPresetAlias('');
setLocalTeamName('');
setLocalLogo('');
setLocalCountryTeam('');
}

function AddPlayer(): void {
Expand Down Expand Up @@ -317,6 +321,15 @@ export const TeamPresetCreator: React.FC = () => {
{teamLogoList}
</Select>
</FormControl>
<FormControl variant="filled" fullWidth>
<InputLabel id="countryTeamLabel">Country</InputLabel>
<Select
labelId="countryTeamLabel"
value={localCountryTeam}
onChange={(e) => setLocalCountryTeam(e.target.value as string)}>
{flagListMap}
</Select>
</FormControl>
<TextField
required
label="Alias"
Expand Down
3 changes: 2 additions & 1 deletion src/extension/team-import-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ nodecg.listenFor('pushNewPlayerData', (player: TeamsPreset['players'][0]) => {
pushNewPlayerData(player);
});

nodecg.listenFor('newTeam', (data: { name: string; alias: string; logo?: string }) => {
nodecg.listenFor('newTeam', (data: { name: string; alias: string; logo?: string; country?: string }) => {
nodecg.log.info('Adding ' + data.alias);
const teamObj: TeamMeta = {
alias: data.alias,
name: data.name,
logo: data.logo,
country: data.country,
};
// Clear undefined props
_.pickBy(teamObj, _.identity);
Expand Down
1 change: 1 addition & 0 deletions types/team-preset.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ interface TeamMeta {
alias: string;
name: string;
logo?: string;
country?: string;
}

interface Player {
Expand Down