-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ target/ | |
*.md | ||
*.rs | ||
RustPython/ | ||
ibps-desktop/target-desktop | ||
ibps-desktop/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
/target-desktop/ | ||
build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# When using macOS, you can build for Windows too | ||
# See: https://tauri.app/v1/guides/building/cross-platform | ||
|
||
from os import system | ||
|
||
TARGET='CARGO_TARGET_DIR' | ||
DARWIN='universal-apple-darwin' | ||
WINDOWS='x86_64-pc-windows-msvc' | ||
|
||
# build for macOS (universal binary) | ||
# rustup target add universal-apple-darwin | ||
system(f'{TARGET} cargo tauri build --target {DARWIN}') | ||
|
||
# build for Windows | ||
# rustup target add x86_64-pc-windows-msvc | ||
# cargo install --locked cargo-xwin | ||
system(f'{TARGET} cargo tauri build --runner cargo-xwin --target {WINDOWS}') | ||
|
||
system('mkdir build') | ||
system(f'cp target-desktop/{DARWIN}/release/bundle/dmg/*.dmg build') | ||
system(f'cp target-desktop/{WINDOWS}/release/bundle/nsis/*.exe build') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# When using macOS, you can build for Windows too | ||
# See: https://tauri.app/v1/guides/building/cross-platform | ||
|
||
DARWIN='universal-apple-darwin' | ||
WINDOWS='x86_64-pc-windows-msvc' | ||
|
||
# build for macOS (universal binary) | ||
# rustup target add universal-apple-darwin | ||
CARGO_TARGET_DIR=target-desktop cargo tauri build --target $DARWIN | ||
|
||
# build for Windows | ||
# brew install nsis | ||
# rustup target add x86_64-pc-windows-msvc | ||
# cargo install --locked cargo-xwin | ||
CARGO_TARGET_DIR=target-desktop cargo tauri build --runner cargo-xwin --target $WINDOWS | ||
|
||
mkdir -p build | ||
cp target-desktop/$DARWIN/release/bundle/dmg/*.dmg build | ||
cp target-desktop/$WINDOWS/release/bundle/nsis/*.exe build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useDesktopDownloadURLs } from "../../../../hooks/useDesktopDownloadURLs"; | ||
|
||
const DownloadDesktopAppModal: React.FC = () => { | ||
const secondaryButton = | ||
"cursor-pointer highlight w-full flex-1 rounded-md bg-idelight-300 py-2 px-3 text-idelight-800 dark:bg-idedark-700 dark:text-white"; | ||
const primaryButton = | ||
"cursor-pointer highlight w-full flex-1 text-nowrap rounded-md bg-idelight-accent py-2 px-3 text-white dark:bg-idedark-accent"; | ||
const downloadURLs = useDesktopDownloadURLs(); | ||
|
||
const os = undefined; // TODO: Implement this later | ||
|
||
return ( | ||
<div className="flex h-full w-full flex-col items-center gap-2"> | ||
<img | ||
alt="IBPS IDE Icon" | ||
src="/favicon.png" | ||
className="mb-2 h-20 w-20 mix-blend-luminosity" | ||
></img> | ||
<div className="text-lg font-medium">IBPS IDE for Desktop</div> | ||
<div className="pb-4">Download and install the new desktop app</div> | ||
<a | ||
href={downloadURLs?.macos} | ||
className={os === "macOS" ? primaryButton : secondaryButton} | ||
> | ||
Download for macOS | ||
</a> | ||
<a | ||
href={downloadURLs?.windows} | ||
className={os === "Windows" ? primaryButton : secondaryButton} | ||
> | ||
Download for Windows | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DownloadDesktopAppModal; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useEffect, useState } from "preact/hooks"; | ||
import { getVersion } from "@tauri-apps/api/app"; | ||
|
||
export type UseDesktopDownloadURLs = { | ||
version: string; | ||
macos: string; | ||
windows: string; | ||
genericDownloadPage: string; | ||
updateAvailable?: boolean; | ||
}; | ||
|
||
export const useDesktopDownloadURLs = (): UseDesktopDownloadURLs | undefined => { | ||
const [out, setOut] = useState<UseDesktopDownloadURLs | undefined>(undefined); | ||
|
||
useEffect(() => { | ||
(async () => { | ||
const USER = "baris-inandi"; | ||
const REPO = "ibps"; | ||
const apiEndpoint = `https://api.github.com/repos/${USER}/${REPO}/releases/latest`; | ||
const response = await (await fetch(apiEndpoint)).json(); | ||
const assets = response.assets; | ||
const macos: string = assets.find((asset: any) => | ||
asset.name.includes(".dmg"), | ||
)?.browser_download_url; | ||
const windows: string = assets.find( | ||
(asset: any) => asset.name.includes("x64") && asset.name.includes(".exe"), | ||
)?.browser_download_url; | ||
setOut({ | ||
version: response.tag_name, | ||
macos, | ||
windows, | ||
genericDownloadPage: `https://github.com/${USER}/${REPO}/releases/latest`, | ||
updateAvailable: window.__TAURI__ && (await getVersion()) !== response.tag_name, | ||
}); | ||
})(); | ||
}, [setOut]); | ||
|
||
return out; | ||
}; |