Apply suggestions
continuous-integration/drone/push Build is passing Details

pull/120/head
maxime 1 year ago
parent 47d81bb665
commit 262cf97445

@ -823,7 +823,6 @@ function EditorPage({
<div id="exports-popup">
<ExportTacticPopup
service={service.getTacticService()}
show={showExportPopup}
onHide={() => setShowExportPopup(false)}
/>
</div>

@ -74,19 +74,19 @@ function homePageStateReducer(
): HomePageState {
switch (action.type) {
case HomePageStateActionKind.UPDATE_TACTICS:
return { ...state!, tactics: action.tactics }
return { ...state, tactics: action.tactics }
case HomePageStateActionKind.UPDATE_TEAMS:
return { ...state!, teams: action.teams }
return { ...state, teams: action.teams }
case HomePageStateActionKind.SET_EXPORTING_TACTIC:
return { ...state!, exportingTacticId: action.tacticId }
return { ...state, exportingTacticId: action.tacticId }
case HomePageStateActionKind.ADD_TACTIC:
return { ...state!, tactics: [action.tactic, ...state.tactics] }
return { ...state, tactics: [action.tactic, ...state.tactics] }
case HomePageStateActionKind.REMOVE_TACTIC:
return { ...state!, tactics: state.tactics.filter(t => t.id !== action.tacticId) }
return { ...state, tactics: state.tactics.filter(t => t.id !== action.tacticId) }
case HomePageStateActionKind.INIT:
return action.state
@ -147,7 +147,6 @@ export default function HomePage() {
<div id="exports-popup">
<ExportTacticPopup
service={tacticExportService}
show={true}
onHide={() =>
dispatch({
type: HomePageStateActionKind.SET_EXPORTING_TACTIC,
@ -223,7 +222,7 @@ function TacticImportArea() {
handleChange={handleDrop}
types={["json"]}
hoverTitle="Déposez ici"
label="Séléctionnez ou déposez un fichier ici"></FileUploader>
label="Séléctionnez ou déposez un fichier ici"/>
</div>
)
}

@ -202,7 +202,6 @@ function VisualizerPageContent({
<div id="exports-popup">
<ExportTacticPopup
service={service.getTacticService()}
show={showExportPopup}
onHide={() => setShowExportPopup(false)}
/>
</div>

@ -10,13 +10,11 @@ import { loadPlainTactic } from "../../domains/TacticPersistenceDomain.ts"
export interface ExportTacticPopupProps {
service: TacticService
show: boolean
onHide: () => void
}
export default function ExportTacticPopup({
service,
show,
onHide,
}: ExportTacticPopupProps) {
const [context, setContext] = useState<TacticContext>()
@ -46,8 +44,6 @@ export default function ExportTacticPopup({
return () => window.removeEventListener("keyup", onKeyUp)
}, [onHide])
if (!show) return <></>
if (panicMessage) return <p>{panicMessage}</p>
return (
@ -68,7 +64,7 @@ export default function ExportTacticPopup({
)
setExportPercentage(0)
}}>
<p className="export-card-title">Export in JSON</p>
<p className="export-card-title">Exporter en JSON</p>
<JsonIcon className="json-logo" />
</div>
</div>
@ -87,7 +83,7 @@ async function exportInJson(
const e = document.createElement("a")
e.setAttribute(
"href",
"data:application/octet-stream," +
"data:application/json;charset=utf-8," +
encodeURIComponent(JSON.stringify(tactic, null, 2)),
)
e.setAttribute("download", `${context.name}.json`)

@ -5,7 +5,7 @@
.arrow-action-icon {
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
pointer-events: none;
max-width: 17px;
max-height: 17px;
}

@ -8,6 +8,7 @@ import { visualizer } from "rollup-plugin-visualizer"
export default defineConfig({
build: {
target: "es2021",
cssTarget: ["chrome112"]
},
test: {
environment: "jsdom",

Loading…
Cancel
Save