This commit is contained in:
Lukas Obermann
2019-11-11 10:28:06 +01:00
parent 119766f702
commit 846dc2e44b
4 changed files with 20 additions and 28 deletions
+7 -17
View File
@@ -6,7 +6,7 @@ import { UpdateInfo } from "electron-updater";
import * as fs from "fs";
import { extname, join } from "path";
import { toMsg, tryIO } from "../../Control/Exception";
import { bimap, Either, either, eitherToMaybe, first, fromLeft, fromLeft_, fromRight_, isLeft, isRight, Left, Right } from "../../Data/Either";
import { bimap, Either, either, eitherToMaybe, first, fromLeft_, fromRight_, isLeft, isRight, Left, Right } from "../../Data/Either";
import { flip } from "../../Data/Function";
import { fmap, fmapF } from "../../Data/Functor";
import { over } from "../../Data/Lens";
@@ -119,8 +119,8 @@ export const requestInitialData: ReduxAction<Promise<void>> = async dispatch =>
}
else {
dispatch (addAlert ({
title: fst (data),
message: fromLeft ("") (snd (data)),
title: fst (fromLeft_ (data)),
message: snd (fromLeft_ (data)),
}))
}
})
@@ -135,14 +135,14 @@ export const getInitialData: ReduxAction<Promise<Either<Pair<string, string>, In
const deleted = await deleteCache ()
if (isLeft (deleted)) {
return first (toMsg) (deleted)
return first (pipe (toMsg, Pair ("Error"))) (deleted)
}
}
const update_written = await writeUpdate (false)
if (isLeft (update_written)) {
return first (toMsg) (update_written)
return first (pipe (toMsg, Pair ("Error"))) (update_written)
}
// parsing error inside, missing file outside
@@ -160,12 +160,7 @@ export const getInitialData: ReduxAction<Promise<Either<Pair<string, string>, In
console.error (`Config parse error: ${msg}`)
dispatch (addAlert ({
message: msg,
title: "Error",
}))
return Left (msg)
return Left (Pair ("Config Error", msg))
}
const mconfig = eitherToMaybe (fromRight_ (eeconfig_flipped))
@@ -181,12 +176,7 @@ export const getInitialData: ReduxAction<Promise<Either<Pair<string, string>, In
return bimap ((msg: string) => {
console.error (`Table parse error: ${msg}`)
dispatch (addAlert ({
message: msg,
title: "Error",
}))
return msg
return Pair ("Database Error", msg)
})
((tables: TableParseRes): InitialData =>
({
+6 -3
View File
@@ -97,9 +97,12 @@ export const fromJSEnum =
export const fromJSEnumM =
(enum_name: string) =>
<A extends object> (enum_values: A) =>
fromJS ((x): x is EnsureEnumType<A> | undefined => (isString (x) || isNumber (x))
&& isInEnum (enum_values)
(x as GenericEnumType<A>))
fromJS ((x): x is EnsureEnumType<A> | undefined => (
(isString (x) || isNumber (x))
&& isInEnum (enum_values)
(x as GenericEnumType<A>)
)
|| x === undefined)
<Maybe<EnsureEnumType<A>>> (Maybe)
(enum_name)
@@ -69,7 +69,7 @@
label {
display: block;
width: 32mm;
width: 31mm;
font: bold 10px/9mm Alegreya SC;
color: black;
padding: 0;
@@ -121,7 +121,6 @@
&.money .box {
height: 4mm;
text-align: center;
}
&.specifics .box {
@@ -30,7 +30,7 @@ export function BelongingsSheetItemsColumn (props: BelongingsSheetItemsColumnPro
{translate (l10n) ("item")}
</th>
<th className="amount">
{translate (l10n) ("number")}
{translate (l10n) ("number.short")}
</th>
<th className="price">
{translate (l10n) ("price")}
@@ -83,11 +83,11 @@ export function BelongingsSheetItemsColumn (props: BelongingsSheetItemsColumnPro
{replicateR (columnSize - flength (items))
(index => (
<tr key={`undefined-${index}`}>
<td className="name"></td>
<td className="amount"></td>
<td className="price"></td>
<td className="weight"></td>
<td className="where"></td>
<td className="name" />
<td className="amount" />
<td className="price" />
<td className="weight" />
<td className="where" />
</tr>
))}
</tbody>