Skip to content

Commit

Permalink
fix: Update export html size and styling (#42)
Browse files Browse the repository at this point in the history
* Update size and styling

* bump to v7.2
  • Loading branch information
joeldavidw authored Jul 23, 2024
1 parent dda9853 commit 41cfedf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Chronos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.2;
PRODUCT_BUNDLE_IDENTIFIER = com.joeldavidw.ChronosDevDebug;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -874,7 +874,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.2;
PRODUCT_BUNDLE_IDENTIFIER = com.joeldavidw.ChronosDevRelease;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1200,7 +1200,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.2;
PRODUCT_BUNDLE_IDENTIFIER = com.joeldavidw.Chronos;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
21 changes: 13 additions & 8 deletions Chronos/Services/ExportService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ extension ExportService {
.style(safe: """
body {
font-family: sans-serif;
max-width: 1100px;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.token-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
gap: 20px;
padding-top: 12px;
}
Expand Down Expand Up @@ -205,14 +205,19 @@ extension ExportService {
justify-content: space-between;
align-items: center;
}
@media print {
.token-card {
break-inside: avoid;
}
}
""")
),
.body(
.div(attributes: [.class("header-container")],
.h1(attributes: [.style(safe: "font-weight: 700;")], "Chronos Export")),
.h2("Chronos Export")),
.div(attributes: [.class("header-container")],
.h2(attributes: [.style(safe: "font-weight: 500; flex-grow: 1;")], "\(Date().formatted(verbatimStyle))"),
.h2(attributes: [.style(safe: "font-weight: 500; text-align: right;")], "No. of Tokens: \(exportVault.tokens?.count.description ?? "Error")")),
.h4(attributes: [.style(safe: "flex-grow: 1;")], "\(Date().formatted(date: .abbreviated, time: .shortened))"),
.h4(attributes: [.style(safe: "text-align: right;")], "No. of Tokens: \(exportVault.tokens?.count.description ?? "Error")")),
.hr(),
.div(attributes: [.class("token-container")],
.fragment(tokensHtml))
Expand All @@ -237,16 +242,16 @@ extension ExportService {
attributes: [.class("token-card")],
.div(attributes: [.class("token-details")],
.div(attributes: [.class("token-info")],
.h3(attributes: [.style(safe: "margin: 0 0 10px; font-size: 1.5em;")], .text(token.issuer)),
.h4(attributes: [.style(safe: "margin: 0 0 10px; font-size: 1.2em; color: #555;")], .text(token.account)),
.h3(attributes: [.style(safe: "margin: 0 0 10px;")], .text(token.issuer)),
.h4(attributes: [.style(safe: "margin: 0 0 10px; color: #555;")], .text(token.account)),
.div(.text("Secret: "), .code("\(token.secret)")),
.div(.text("Type: "), .code("\(token.type.rawValue)")),
.div(.text("Algorithm: "), .code("\(token.algorithm.rawValue)")),
.div(.text("Digits: "), .code("\(token.digits.description)")),
periodNode,
counterNode),
.div(attributes: [.style(safe: "flex: 0 0 auto;")],
.img(base64: base64Img, type: .image(.png), alt: "", attributes: [.width(150), .height(150)])))
.img(base64: base64Img, type: .image(.png), alt: "", attributes: [.width(160), .height(160)])))
)
}
}

0 comments on commit 41cfedf

Please sign in to comment.