Skip to content

Commit ed2c397

Browse files
author
Michał Gryczka
committed
Refactored various components by removing unused imports and optimizing styles. Updated typography usage in HeaderSection and 404 page. Adjusted image carousel ID generation method for uniqueness. Cleaned up code in multiple pages to enhance readability and maintainability.
1 parent 754ac7b commit ed2c397

30 files changed

Lines changed: 44 additions & 200 deletions

src/components/GithubReleases/GithubReleases.astro

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
import { DownloadIcon } from "../base/icons/DownloadIcon";
3-
import { CheckIcon } from "../base/icons/CheckIcon";
4-
import { PlatformType } from "../base/types/platform";
53
64
interface Props {
75
repoUrl: string;
@@ -24,12 +22,6 @@ const releases = await response.json();
2422
const stableReleases = releases.filter((release: any) => !release.prerelease);
2523
const latestRelease = stableReleases[0]; // Get only the latest release
2624
27-
interface Asset {
28-
name: string;
29-
browser_download_url: string;
30-
size: number;
31-
}
32-
3325
function getAssetDescription(assetName: string): string {
3426
// Mapping based on provided examples
3527
if (/\.deb$/.test(assetName) && /x86_64-unknown-linux-gnu/.test(assetName)) {
@@ -53,22 +45,6 @@ function getAssetDescription(assetName: string): string {
5345
return "";
5446
}
5547
56-
function getPlatformType(assetName: string): PlatformType {
57-
if (assetName.includes("windows")) return PlatformType.WINDOWS;
58-
if (assetName.includes("linux") && assetName.includes(".deb"))
59-
return PlatformType.DEBIAN;
60-
if (
61-
assetName.includes("macos") &&
62-
(assetName.includes("aarch64") || assetName.includes("arm64"))
63-
)
64-
return PlatformType.MACOSARM;
65-
if (
66-
assetName.includes("macos") &&
67-
(assetName.includes("x86_64") || assetName.includes("amd64"))
68-
)
69-
return PlatformType.MACOSINTEL;
70-
return PlatformType.DEBIAN; // Default to Debian if unknown
71-
}
7248
---
7349

7450
<div class="github-releases">

src/components/HeaderSection.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ const { title, description, variant = "white" } = Astro.props;
3636
padding-bottom: 10px;
3737
text-align: left;
3838
text-wrap: balance;
39+
font-size: calc(3.2rem * var(--font-scale-factor));
3940
@include typography(title);
40-
41-
& {
42-
font-size: calc(3.2rem * var(--font-scale-factor));
43-
}
4441
}
4542
}
4643
</style>

src/components/TextDivider.astro

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
---
22
import ContentLimiter from "./ContentLimiter.astro";
3-
interface Props {
4-
text: string;
5-
paddingTop?: string;
6-
as?: "span" | "h2" | "h3";
7-
}
83
const { text, paddingTop = "3rem", as = "span" } = Astro.props;
94
const DividerTag = as;
105
---

src/components/analytics/GTM.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
const isProd = import.meta.env.PROD as boolean;
44
// Get GTM ID from environment variable or use your actual GTM ID
55
const GTM_ID = import.meta.env.PUBLIC_GTM_ID || "GTM-XXXXXXX"; // Replace GTM-XXXXXXX with your actual ID
6+
// Used in template below
7+
void GTM_ID;
68
---
79

810
{

src/components/base/icons/DownloadIcon.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { PlatformType } from "../types/platform";
21

32
interface DownloadIconProps {
43
width?: number;

src/components/buttons/StoreButtons.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
// StoreButtons.astro: Displays Google Play and Apple App Store badges side by side
3-
const googlePlayUrl = "https://play.google.com/store/apps/details?id=net.defguard.mobile";
4-
const appStoreUrl = "https://apps.apple.com/app/idYOUR_APP_ID";
53
---
64
<!-- <div class="store-buttons">
75
<a href={googlePlayUrl} target="_blank" rel="noopener noreferrer" aria-label="Get it on Google Play">

src/components/image/ImageCarousel.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919
const imageUrls = src.split(',').map(url => url.trim()).filter(url => url.length > 0);
2020
2121
// Generate unique ID for this carousel instance
22-
const carouselId = `carousel-${Math.random().toString(36).substr(2, 9)}`;
22+
const carouselId = `carousel-${Math.random().toString(36).slice(2, 11)}`;
2323
---
2424

2525
{imageUrls.length === 1 ? (

src/components/image/ImageURL.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function isExternalUrl(url: string): boolean {
5858
}
5959
6060
// Function to optimize image URL based on format and quality (for external images)
61-
function optimizeImageUrl(url: string, format?: string, quality?: number): string {
61+
function optimizeImageUrl(url: string, _format?: string, _quality?: number): string {
6262
// For external URLs, we can't optimize them directly
6363
// But we can add query parameters if the service supports it
6464
// This is a placeholder for future enhancement
@@ -70,7 +70,7 @@ const isExternal = isExternalUrl(src);
7070
const processedSrc = isExternal ? optimizeImageUrl(src, format, quality) : src;
7171
7272
// Build srcset for responsive images (basic implementation)
73-
function buildSrcSet(baseSrc: string): string | undefined {
73+
function buildSrcSet(_baseSrc: string): string | undefined {
7474
if (!sizes || isExternal) return undefined;
7575
7676
// For internal images, we could generate different sizes

src/components/product/ProductHeader.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import ProductSection from "../../layouts/ProductSection.astro";
2020
row-gap: var(--product-section-items-gap);
2121

2222
h1 {
23-
@include typography(title);
2423
padding-bottom: 20px;
24+
@include typography(title);
2525
}
2626

2727
& > p {

src/components/video/YouTubeVideo.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const {
2323
allowFullscreen = true,
2424
muted = false,
2525
rel = false,
26-
width,
27-
height,
2826
} = Astro.props;
2927
3028
// Build YouTube embed URL with parameters

0 commit comments

Comments
 (0)