Skip to content

Commit e4129c3

Browse files
bstolinskidt-iohk
andauthored
feat(cat-voices): profile app size (#3736)
* feat(cat-voices): svg vector graphics compiler (#3715) * feat: precompile SVG assets * feat: Convert images to WebP * fix(cat-voices): compile svg to binary format (#3728) * compile svg to binary format * refactor * feat(cat-voices): Add precompressed web files and Caddy configuration (#3719) * feat: Add precompressed web files and Caddy configuration * fix Caddy config * fix * fix * fix * refactor * add 'precompressed' to project dictionary * Update catalyst_voices/module.cue Co-authored-by: Dominik Toton <[email protected]> * refactor Caddy config --------- Co-authored-by: Dominik Toton <[email protected]> --------- Co-authored-by: Dominik Toton <[email protected]>
1 parent 13b2aa8 commit e4129c3

File tree

612 files changed

+1131
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+1131
-49
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ postcss
278278
Pozhylenkov
279279
Precache
280280
Precertificate
281+
precompressed
281282
preprod
282283
proguard
283284
projectcatalyst

catalyst_voices/Caddyfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
http://:8080 {
66
root * /app
77

8-
handle /healthz {
9-
respond `{"status":"ok"}` 200
10-
}
11-
12-
handle {
13-
try_files {path} /index.html
14-
file_server
15-
}
8+
# Compress on-the-fly if not precompressed
9+
encode
10+
11+
handle /healthz {
12+
respond `{"status":"ok"}` 200
13+
}
14+
15+
handle {
16+
try_files {path} /index.html
17+
file_server {
18+
# default order br zstd gzip
19+
precompressed
20+
}
21+
}
1622

1723
header {
1824
Cross-Origin-Opener-Policy "same-origin"

catalyst_voices/Earthfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ build-web:
128128
--SENTRY_ORG='iohk-j4' \
129129
--SENTRY_PROJECT='catalyst-voices' \
130130
--WASM=true
131-
131+
132132
# Version web assets with content-based MD5 hashes for cache busting
133133
RUN dart run /frontend/scripts/version_web_assets/version_web_assets.dart --build-dir=$WORKDIR/build/web --wasm=true
134-
134+
135+
DO flutter-ci+COMPRESS_WEB_FILES
136+
135137
SAVE ARTIFACT --keep-ts web
136138

137139
package:

catalyst_voices/apps/voices/lib/common/ext/account_role_ext.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
66
extension AccountRoleExt on AccountRole {
77
SvgGenImage get icon {
88
return switch (this) {
9-
AccountRole.voter => VoicesAssets.images.roleVoter,
10-
AccountRole.drep => VoicesAssets.images.roleDrep,
11-
AccountRole.proposer => VoicesAssets.images.roleProposer,
9+
AccountRole.voter => VoicesAssets.images.svg.roleVoter,
10+
AccountRole.drep => VoicesAssets.images.svg.roleDrep,
11+
AccountRole.proposer => VoicesAssets.images.svg.roleProposer,
1212
};
1313
}
1414

catalyst_voices/apps/voices/lib/pages/registration/pictures/base_profile_picture.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BaseProfilePicture extends StatelessWidget {
1515
return TaskPicture(
1616
child: TaskPictureIconBox(
1717
type: type,
18-
child: VoicesAssets.images.createBaseProfile.buildIcon(
18+
child: VoicesAssets.images.svg.createBaseProfile.buildIcon(
1919
allowSize: false,
2020
),
2121
),

catalyst_voices/apps/voices/lib/pages/registration/pictures/keychain_picture.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class KeychainPicture extends StatelessWidget {
1515
return TaskPicture(
1616
child: TaskPictureIconBox(
1717
type: type,
18-
child: VoicesAssets.images.keychain.buildIcon(allowSize: false),
18+
child: VoicesAssets.images.svg.keychain.buildIcon(allowSize: false),
1919
),
2020
);
2121
}

catalyst_voices/apps/voices/lib/pages/registration/pictures/keychain_with_password_picture.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class KeychainWithPasswordPicture extends StatelessWidget {
1313
child: Stack(
1414
alignment: Alignment.center,
1515
children: [
16-
VoicesAssets.images.keychain.buildIcon(allowSize: false),
16+
VoicesAssets.images.svg.keychain.buildIcon(allowSize: false),
1717
Align(
1818
alignment: const Alignment(0.52, -0.4),
1919
child: VoicesAssets.icons.lockClosed.buildIcon(),

catalyst_voices/apps/voices/lib/pages/voting/widgets/voting_list/voting_list_ballot.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class _VotingListBallotEmptyState extends StatelessWidget {
7676
return Align(
7777
alignment: const Alignment(0, -0.3),
7878
child: EmptyState(
79-
image: VoicesAssets.images.noVotes.buildPicture(),
79+
image: VoicesAssets.images.svg.noVotes.buildPicture(),
8080
title: Text(_buildTitleParts(context).join('\n')),
8181
constraints: const BoxConstraints(maxWidth: 236),
8282
),

catalyst_voices/apps/voices/lib/widgets/common/resizable_box_parent.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class _ResizableBoxState extends State<_ResizableBox> {
103103
}
104104
});
105105
},
106-
child: VoicesAssets.images.dragger.buildIcon(size: 15),
106+
child: VoicesAssets.images.svg.dragger.buildIcon(size: 15),
107107
),
108108
),
109109
],

catalyst_voices/apps/voices/lib/widgets/empty_state/specialized/proposals_pagination_empty_state.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ProposalsPaginationEmptyState extends StatelessWidget {
3333
? Text(context.l10n.tryDifferentSearch)
3434
: Text(context.l10n.discoverySpaceEmptyProposals),
3535
image: VoicesImagesScheme(
36-
image: VoicesAssets.images.noProposalForeground.buildPicture(),
36+
image: VoicesAssets.images.svg.noProposalForeground.buildPicture(),
3737
background: Container(
3838
height: 180,
3939
decoration: BoxDecoration(

0 commit comments

Comments
 (0)