-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move apps and team page scripts out of landing-page.js #27137
Open
amanagr
wants to merge
6
commits into
zulip:main
Choose a base branch
from
amanagr:portico_refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3cc2fa1
apps: Extract script to load apps data.
amanagr 3c00cd2
google_analytics: Extract id directly from `#page-params`.
amanagr b0593f9
blueslip: Extract development_environment directly from `#page-params`.
amanagr 737a571
sentry: Extract required params directly from `#page-params`.
amanagr 3ea1dac
team: Extract script to run to its own file.
amanagr 2ae4e5c
sentry: Extract functions used by channel into a util file.
amanagr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import $ from "jquery"; | ||
|
||
import macbook_image from "../../images/app-screenshots/macbook.png"; | ||
import microsoft_image from "../../images/app-screenshots/microsoft.png"; | ||
import ubuntu_image from "../../images/app-screenshots/ubuntu.png"; | ||
import android_image from "../../images/app-screenshots/zulip-android.png"; | ||
import iphone_image from "../../images/app-screenshots/zulip-iphone-rough.png"; | ||
|
||
import {path_parts} from "./landing-page"; | ||
import {detect_user_os} from "./tabbed-instructions"; | ||
|
||
const apps_events = function () { | ||
const info = { | ||
windows: { | ||
image: microsoft_image, | ||
alt: "Windows", | ||
description: | ||
"Zulip for Windows is even better than Zulip on the web, with a cleaner look, tray integration, native notifications, and support for multiple Zulip accounts.", | ||
download_link: "/apps/download/windows", | ||
show_instructions: true, | ||
install_guide: "/help/desktop-app-install-guide", | ||
app_type: "desktop", | ||
}, | ||
mac: { | ||
image: macbook_image, | ||
alt: "macOS", | ||
description: | ||
"Zulip on macOS is even better than Zulip on the web, with a cleaner look, tray integration, native notifications, and support for multiple Zulip accounts.", | ||
download_link: "/apps/download/mac", | ||
mac_arm64_link: "/apps/download/mac-arm64", | ||
show_instructions: true, | ||
install_guide: "/help/desktop-app-install-guide", | ||
app_type: "desktop", | ||
}, | ||
android: { | ||
image: android_image, | ||
alt: "Android", | ||
description: "Zulip's native Android app makes it easy to keep up while on the go.", | ||
show_instructions: false, | ||
play_store_link: "https://play.google.com/store/apps/details?id=com.zulipmobile", | ||
download_link: "https://github.com/zulip/zulip-mobile/releases/latest", | ||
app_type: "mobile", | ||
}, | ||
ios: { | ||
image: iphone_image, | ||
alt: "iOS", | ||
description: "Zulip's native iOS app makes it easy to keep up while on the go.", | ||
show_instructions: false, | ||
app_store_link: "https://itunes.apple.com/us/app/zulip/id1203036395", | ||
app_type: "mobile", | ||
}, | ||
linux: { | ||
image: ubuntu_image, | ||
alt: "Linux", | ||
description: | ||
"Zulip on the Linux desktop is even better than Zulip on the web, with a cleaner look, tray integration, native notifications, and support for multiple Zulip accounts.", | ||
download_link: "/apps/download/linux", | ||
show_instructions: true, | ||
install_guide: "/help/desktop-app-install-guide", | ||
app_type: "desktop", | ||
}, | ||
}; | ||
|
||
let version; | ||
|
||
function get_version_from_path() { | ||
let result; | ||
const parts = path_parts(); | ||
|
||
for (const version of Object.keys(info)) { | ||
if (parts.includes(version)) { | ||
result = version; | ||
} | ||
} | ||
|
||
result = result || detect_user_os(); | ||
return result; | ||
} | ||
|
||
const update_page = function () { | ||
const $download_instructions = $(".download-instructions"); | ||
const $third_party_apps = $("#third-party-apps"); | ||
const $download_android_apk = $("#download-android-apk"); | ||
const $download_from_google_play_store = $(".download-from-google-play-store"); | ||
const $download_from_apple_app_store = $(".download-from-apple-app-store"); | ||
const $download_from_microsoft_store = $("#download-from-microsoft-store"); | ||
const $download_mac_arm64 = $("#download-mac-arm64"); | ||
const $desktop_download_link = $(".desktop-download-link"); | ||
const version_info = info[version]; | ||
|
||
$(".info .platform").text(version_info.alt); | ||
$(".info .description").text(version_info.description); | ||
$desktop_download_link.attr("href", version_info.download_link); | ||
$download_from_google_play_store.attr("href", version_info.play_store_link); | ||
$download_from_apple_app_store.attr("href", version_info.app_store_link); | ||
$download_android_apk.attr("href", version_info.download_link); | ||
$download_mac_arm64.attr("href", version_info.mac_arm64_link); | ||
$(".image img").addClass(`app-screenshot-${version_info.app_type}`); | ||
$(".image img").attr("src", version_info.image); | ||
$download_instructions.find("a").attr("href", version_info.install_guide); | ||
|
||
$download_instructions.toggle(version_info.show_instructions); | ||
|
||
$third_party_apps.toggle(version_info.app_type === "desktop"); | ||
$desktop_download_link.toggle(version_info.app_type === "desktop"); | ||
$download_android_apk.toggle(version === "android"); | ||
$download_from_google_play_store.toggle(version === "android"); | ||
$download_from_apple_app_store.toggle(version === "ios"); | ||
$download_from_microsoft_store.toggle(version === "windows"); | ||
$download_mac_arm64.toggle(version === "mac"); | ||
}; | ||
|
||
// init | ||
version = get_version_from_path(); | ||
update_page(); | ||
}; | ||
|
||
apps_events(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import {gtag, install} from "ga-gtag"; | ||
|
||
import {page_params} from "../page_params"; | ||
import $ from "jquery"; | ||
|
||
export let config; | ||
const google_analytics_id = $("#page-params").data("params").google_analytics_id; | ||
|
||
if (page_params.google_analytics_id !== undefined) { | ||
install(page_params.google_analytics_id); | ||
config = (info) => gtag("config", page_params.google_analytics_id, info); | ||
if (google_analytics_id !== undefined) { | ||
install(google_analytics_id); | ||
config = (info) => gtag("config", google_analytics_id, info); | ||
} else { | ||
config = () => {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems dangerous, in that
page_params.ts
removes it from the DOM in the web app itself. Also, we really really don't want to have jQuery parse the params twice; it is an expensive operation for large organizations like chat.zulip.org.Probably a good #frontend conversation about what we want to do with this detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the most likely theory for how to fix this is to put the actual app parameters into a separate
data-app-params
bucket from the "common" stuff used by Sentry/Blueslip and smaller pages, and those things can be parsed multiple times safely as they would not be huge. But I'm not sure and it deserves a proper discussion.