Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Armaldio committed Sep 17, 2024
1 parent 3150ec0 commit fd91b80
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 427 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dependencies": {
"@primevue/themes": "^4.0.6",
"@vueuse/core": "^11.0.3",
"date-fns": "^4.1.0",
"pinia": "^2.1.7",
"primeflex": "^3.3.1",
"primeicons": "^7.0.0",
Expand All @@ -25,6 +26,8 @@
},
"devDependencies": {
"@iconify-json/line-md": "^1.2.1",
"@iconify-json/simple-icons": "^1.2.3",
"@iconify/vue": "^4.1.2",
"@playwright/test": "^1.44.1",
"@tsconfig/node20": "^20.1.4",
"@types/jsdom": "^21.1.7",
Expand Down
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions src/components/DownloadCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<div class="os-card">
<div class="flex align-items-center mb-4">
<span class="text-4xl mr-2">
<Icon height="22" :icon="getOsIcon(os)" /></span>
<h2 class="text-2xl font-semibold">{{ os }}</h2>
<span
v-if="os === 'Windows'"
class="ml-2 px-2 py-1 bg-yellow-100 text-yellow-900 text-xs border-round"
>Unsigned</span
>
</div>
<div
v-for="option in options"
:key="option.value"
class="flex justify-content-between align-items-center mb-2"
>
<span>{{ option.label }}</span>
<Button as="a" :href="option.value" icon="pi pi-download" text rounded class="p-button-sm primary-btn" />
</div>
</div>
</template>

<script setup>
import { defineProps } from "vue";
import Button from "primevue/button";
import { Icon } from '@iconify/vue';
const props = defineProps({
os: String,
options: Array,
});
const getOsIcon = (os) => {
switch (os) {
case "macOS":
return "simple-icons:apple";
case "Windows":
return "simple-icons:windows10";
case "Linux":
return "simple-icons:linux";
default:
return "";
}
};
</script>

<style lang="scss" scoped>
.os-card {
background-color: #fff;
border-radius: 16px;
padding: 1rem 1rem;
transition: transform 0.3s ease, box-shadow 0.3s ease;
position: relative;
border: 1px solid #f1f1f1;
width: 300px;
}
</style>
192 changes: 122 additions & 70 deletions src/views/download.vue
Original file line number Diff line number Diff line change
@@ -1,86 +1,138 @@
<template>
<div class="flex flex-col items-center p-8 bg-gray-100 min-h-screen">
<img
alt="Dataflare Logo"
class="w-16 h-16 mb-4"
/>
<h1 class="text-2xl font-bold mb-2">Download Dataflare</h1>
<p class="text-gray-600 mb-8">
<div class="flex flex-column align-items-center p-8 surface-100">
<!-- <img
alt="Cyn Logo"
class="w-4rem h-4rem mb-4"
/> -->
<h1 class="text-4xl font-bold mb-2">Download Cyn</h1>
<p class="text-color-secondary mb-8">
Choose the version that suits your operating system (OS) and CPU
architecture
</p>

<div class="flex flex-wrap justify-center gap-8">
<DownloadCard
os="macOS"
:options="macOptions"
brewCommand="brew install dataflare"
/>
<DownloadCard
os="Windows"
:options="windowsOptions"
wingetCommand="winget install Dataflare.Dataflare"
/>
<div class="flex flex-wrap justify-content-center gap-4">
<DownloadCard os="macOS" :options="macOptions" />
<DownloadCard os="Windows" :options="windowsOptions" />
<DownloadCard os="Linux" :options="linuxOptions" />
</div>
<div class="flex flex-column text-center justify-content-center mt-8">
<p>Looking for older versions?</p>
<a href="https://github.com/CynToolkit/cyn/releases"
>Check the releases page</a
>
</div>
</div>
</template>

<script setup lang="ts">
import { defineComponent, ref } from "vue";
import { computed, ref } from "vue";
import DownloadCard from "@/components/DownloadCard.vue";

Check failure on line 28 in src/views/download.vue

View workflow job for this annotation

GitHub Actions / build

Could not find a declaration file for module '@/components/DownloadCard.vue'. '/home/runner/work/website/website/src/components/DownloadCard.vue' implicitly has an 'any' type.

Check failure on line 28 in src/views/download.vue

View workflow job for this annotation

GitHub Actions / build

Could not find a declaration file for module '@/components/DownloadCard.vue'. '/home/runner/work/website/website/src/components/DownloadCard.vue' implicitly has an 'any' type.
import { isAfter } from "date-fns";
const macOptions = ref([
{ label: ".dmg (Apple Silicon)", value: "apple-silicon" },
{ label: ".dmg (Intel)", value: "intel" },
]);
const windowsOptions = ref([{ label: ".exe (x86_64)", value: "x86_64" }]);
const macOptions = computed(() => ([
{ label: ".dmg (arm64)", value: release.value?.assets.find(asset => asset.name.includes("arm64.dmg"))?.browser_download_url },
{ label: ".zip", value: release.value?.assets.find(asset => asset.name.includes("darwin-arm64"))?.browser_download_url }
]));
const linuxOptions = ref([
{ label: ".AppImage (x86_64)", value: "x86_64" },
{ label: ".AppImage (AArch64)", value: "aarch64" },
]);
const windowsOptions = computed(() => ([
{ label: ".exe", value: release.value?.assets.find(asset => asset.name.includes(".Setup.exe"))?.browser_download_url },
{ label: ".zip", value: release.value?.assets.find(asset => asset.name.includes("win32-x64"))?.browser_download_url }
]));
const DownloadCard = defineComponent({
props: {
os: String,
options: Array,
brewCommand: String,
wingetCommand: String,
},
setup(props) {
const getOsIcon = (os: string) => {
switch (os) {
case "macOS":
return "🍎";
case "Windows":
return "🪟";
case "Linux":
return "🐧";
default:
return "";
}
};
const linuxOptions = computed(() => ([
{ label: ".zip", value: release.value?.assets.find(asset => asset.name.includes("linux-x64"))?.browser_download_url },
]))
return { getOsIcon };
},
template: `
<div class="bg-white rounded-lg shadow-md p-6 w-80">
<div class="flex items-center mb-4">
<span class="text-2xl mr-2">{{ getOsIcon(os) }}</span>
<h2 class="text-xl font-semibold">{{ os }}</h2>
<span v-if="os === 'Windows'" class="ml-2 px-2 py-1 bg-yellow-200 text-yellow-800 text-xs rounded">Unsigned</span>
</div>
<div v-if="brewCommand || wingetCommand" class="bg-gray-100 p-2 rounded mb-4 font-mono text-sm">
{{ brewCommand || wingetCommand }}
</div>
<div v-for="option in options" :key="option.value" class="flex justify-between items-center mb-2">
<span>{{ option.label }}</span>
<button class="bg-blue-500 text-white px-3 py-1 rounded hover:bg-blue-600 transition">↓</button>
</div>
</div>
`,
});
</script>
export interface Release {
url: string
assets_url: string
upload_url: string
html_url: string
id: number
author: Author
node_id: string
tag_name: string
target_commitish: string
name: string
draft: boolean
prerelease: boolean
created_at: string
published_at: string
assets: Asset[]
tarball_url: string
zipball_url: string
body: string
}
export interface Author {
login: string
id: number
node_id: string
avatar_url: string
gravatar_id: string
url: string
html_url: string
followers_url: string
following_url: string
gists_url: string
starred_url: string
subscriptions_url: string
organizations_url: string
repos_url: string
events_url: string
received_events_url: string
type: string
site_admin: boolean
}
<style lang="scss" scoped></style>
export interface Asset {
url: string
id: number
node_id: string
name: string
label: string
uploader: Uploader
content_type: string
state: string
size: number
download_count: number
created_at: string
updated_at: string
browser_download_url: string
}
export interface Uploader {
login: string
id: number
node_id: string
avatar_url: string
gravatar_id: string
url: string
html_url: string
followers_url: string
following_url: string
gists_url: string
starred_url: string
subscriptions_url: string
organizations_url: string
repos_url: string
events_url: string
received_events_url: string
type: string
site_admin: boolean
}
const release = ref<Release>();
fetch("https://api.github.com/repos/CynToolkit/cyn/releases/latest", {
headers: {
"Accept": "application/vnd.github+json",
}
})
.then(response => response.json())
.then((data: Release) => {
console.log(data)
release.value = data
})
</script>
Loading

0 comments on commit fd91b80

Please sign in to comment.