Skip to content

Commit

Permalink
Merge branch 'main' into new-orgs-page
Browse files Browse the repository at this point in the history
  • Loading branch information
Prospector authored Aug 28, 2024
2 parents 75f7874 + 4b75cb8 commit a27b5f4
Show file tree
Hide file tree
Showing 27 changed files with 223 additions and 200 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
if: startsWith(matrix.platform, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev sqlite3
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install frontend dependencies
run: pnpm install
Expand Down
5 changes: 3 additions & 2 deletions apps/app-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
"@vintl/vintl": "^4.4.1",
"dayjs": "^1.11.10",
"floating-vue": "^5.2.2",
"mixpanel-browser": "^2.49.0",
"ofetch": "^1.3.4",
"pinia": "^2.1.7",
"vite-svg-loader": "^5.1.0",
"vue": "^3.4.21",
"vue-multiselect": "3.0.0",
"vue-router": "4.3.0",
"vue-virtual-scroller": "v2.0.0-beta.8"
"vue-virtual-scroller": "v2.0.0-beta.8",
"posthog-js": "^1.158.2",
"@sentry/vue": "^8.27.0"
},
"devDependencies": {
"@tauri-apps/cli": "^2.0.0-rc",
Expand Down
22 changes: 7 additions & 15 deletions apps/app-frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@ import { command_listener, warning_listener } from '@/helpers/events.js'
import { MinimizeIcon, MaximizeIcon } from '@/assets/icons'
import { type } from '@tauri-apps/plugin-os'
import { isDev, getOS } from '@/helpers/utils.js'
import {
mixpanel_track,
mixpanel_init,
mixpanel_opt_out_tracking,
mixpanel_is_loaded,
} from '@/helpers/mixpanel'
import { saveWindowState, StateFlags } from '@tauri-apps/plugin-window-state'
import { initAnalytics, debugAnalytics, optOutAnalytics, trackEvent } from '@/helpers/analytics'
import { getCurrentWindow } from '@tauri-apps/api/window'
import { getVersion } from '@tauri-apps/api/app'
import { TauriEvent } from '@tauri-apps/api/event'
import URLConfirmModal from '@/components/ui/URLConfirmModal.vue'
import { install_from_file } from './helpers/pack'
import { useError } from '@/store/error.js'
Expand Down Expand Up @@ -90,11 +83,12 @@ async function setupApp() {
themeStore.collapsedNavigation = collapsed_navigation
themeStore.advancedRendering = advanced_rendering
mixpanel_init('014c7d6a336d0efaefe3aca91063748d', { debug: dev, persistence: 'localStorage' })
initAnalytics()
if (!telemetry) {
mixpanel_opt_out_tracking()
optOutAnalytics()
}
mixpanel_track('Launched', { version, dev, onboarded })
if (dev) debugAnalytics()
trackEvent('Launched', { version, dev, onboarded })
if (!dev) document.addEventListener('contextmenu', (event) => event.preventDefault())
Expand Down Expand Up @@ -137,9 +131,7 @@ const handleClose = async () => {
const router = useRouter()
router.afterEach((to, from, failure) => {
if (mixpanel_is_loaded()) {
mixpanel_track('PageView', { path: to.path, fromPath: from.path, failed: failure })
}
trackEvent('PageView', { path: to.path, fromPath: from.path, failed: failure })
})
const route = useRoute()
const isOnBrowse = computed(() => route.path.startsWith('/browse'))
Expand Down Expand Up @@ -214,7 +206,7 @@ async function handleCommand(e) {
// RunMRPack should directly install a local mrpack given a path
if (e.path.endsWith('.mrpack')) {
await install_from_file(e.path).catch(handleError)
mixpanel_track('InstanceCreate', {
trackEvent('InstanceCreate', {
source: 'CreationModalFileDrop',
})
}
Expand Down
6 changes: 3 additions & 3 deletions apps/app-frontend/src/components/RowDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { duplicate, kill, remove, run } from '@/helpers/profile.js'
import { useRouter } from 'vue-router'
import { showProfileInFolder } from '@/helpers/utils.js'
import { useTheming } from '@/store/state.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { trackEvent } from '@/helpers/analytics'
import { handleSevereError } from '@/store/error.js'
import { install as installVersion } from '@/store/install.js'
Expand Down Expand Up @@ -125,14 +125,14 @@ const handleOptionsClick = async (args) => {
await run(args.item.path).catch((err) =>
handleSevereError(err, { profilePath: args.item.path }),
)
mixpanel_track('InstanceStart', {
trackEvent('InstanceStart', {
loader: args.item.loader,
game_version: args.item.game_version,
})
break
case 'stop':
await kill(args.item.path).catch(handleError)
mixpanel_track('InstanceStop', {
trackEvent('InstanceStop', {
loader: args.item.loader,
game_version: args.item.game_version,
})
Expand Down
6 changes: 3 additions & 3 deletions apps/app-frontend/src/components/ui/AccountsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {
get_default_user,
} from '@/helpers/auth'
import { handleError } from '@/store/state.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { trackEvent } from '@/helpers/analytics'
import { process_listener } from '@/helpers/events'
import { handleSevereError } from '@/store/error.js'
Expand Down Expand Up @@ -118,7 +118,7 @@ async function login() {
await refreshValues()
}
mixpanel_track('AccountLogIn')
trackEvent('AccountLogIn')
}
const logout = async (id) => {
Expand All @@ -130,7 +130,7 @@ const logout = async (id) => {
} else {
emit('change')
}
mixpanel_track('AccountLogOut')
trackEvent('AccountLogOut')
}
let showCard = ref(false)
Expand Down
4 changes: 2 additions & 2 deletions apps/app-frontend/src/components/ui/ErrorModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { ChatIcon } from '@/assets/icons'
import { ref } from 'vue'
import { login as login_flow, set_default_user } from '@/helpers/auth.js'
import { handleError } from '@/store/notifications.js'
import mixpanel from 'mixpanel-browser'
import { handleSevereError } from '@/store/error.js'
import { cancel_directory_change } from '@/helpers/settings.js'
import { install } from '@/helpers/profile.js'
import { trackEvent } from '@/helpers/analytics'
const errorModal = ref()
const error = ref()
Expand Down Expand Up @@ -85,7 +85,7 @@ async function loginMinecraft() {
await set_default_user(loggedIn.id).catch(handleError)
}
await mixpanel.track('AccountLogIn')
await trackEvent('AccountLogIn', { source: 'ErrorModal' })
loadingMinecraft.value = false
errorModal.value.hide()
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions apps/app-frontend/src/components/ui/Instance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { get_by_profile_path } from '@/helpers/process'
import { process_listener } from '@/helpers/events'
import { handleError } from '@/store/state.js'
import { showProfileInFolder } from '@/helpers/utils.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { handleSevereError } from '@/store/error.js'
import { trackEvent } from '@/helpers/analytics'
const props = defineProps({
instance: {
Expand Down Expand Up @@ -45,7 +45,7 @@ const play = async (e, context) => {
)
modLoading.value = false
mixpanel_track('InstancePlay', {
trackEvent('InstancePlay', {
loader: props.instance.loader,
game_version: props.instance.game_version,
source: context,
Expand All @@ -58,7 +58,7 @@ const stop = async (e, context) => {
await kill(props.instance.path).catch(handleError)
mixpanel_track('InstanceStop', {
trackEvent('InstanceStop', {
loader: props.instance.loader,
game_version: props.instance.game_version,
source: context,
Expand Down
10 changes: 5 additions & 5 deletions apps/app-frontend/src/components/ui/InstanceCreationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ import { convertFileSrc } from '@tauri-apps/api/core'
import { get_game_versions, get_loader_versions } from '@/helpers/metadata'
import { handleError } from '@/store/notifications.js'
import Multiselect from 'vue-multiselect'
import { mixpanel_track } from '@/helpers/mixpanel'
import { trackEvent } from '@/helpers/analytics'
import { useTheming } from '@/store/state.js'
import { listen } from '@tauri-apps/api/event'
import { install_from_file } from '@/helpers/pack.js'
Expand Down Expand Up @@ -264,13 +264,13 @@ defineExpose({
hide()
if (event.payload && event.payload.length > 0 && event.payload[0].endsWith('.mrpack')) {
await install_from_file(event.payload[0]).catch(handleError)
mixpanel_track('InstanceCreate', {
trackEvent('InstanceCreate', {
source: 'CreationModalFileDrop',
})
}
})
mixpanel_track('InstanceCreateStart', { source: 'CreationModal' })
trackEvent('InstanceCreateStart', { source: 'CreationModal' })
},
})
Expand Down Expand Up @@ -360,7 +360,7 @@ const create_instance = async () => {
icon.value,
).catch(handleError)
mixpanel_track('InstanceCreate', {
trackEvent('InstanceCreate', {
profile_name: profile_name.value,
game_version: game_version.value,
loader: loader.value,
Expand Down Expand Up @@ -419,7 +419,7 @@ const openFile = async () => {
hide()
await install_from_file(newProject).catch(handleError)
mixpanel_track('InstanceCreate', {
trackEvent('InstanceCreate', {
source: 'CreationModalFileOpen',
})
}
Expand Down
4 changes: 2 additions & 2 deletions apps/app-frontend/src/components/ui/JavaDetectionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import { Modal, Button } from '@modrinth/ui'
import { ref } from 'vue'
import { find_filtered_jres } from '@/helpers/jre.js'
import { handleError } from '@/store/notifications.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { useTheming } from '@/store/theme.js'
import { trackEvent } from '@/helpers/analytics'
const themeStore = useTheming()
Expand All @@ -67,7 +67,7 @@ const emit = defineEmits(['submit'])
function setJavaInstall(javaInstall) {
emit('submit', javaInstall)
detectJavaModal.value.hide()
mixpanel_track('JavaAutoDetect', {
trackEvent('JavaAutoDetect', {
path: javaInstall.path,
version: javaInstall.version,
})
Expand Down
8 changes: 4 additions & 4 deletions apps/app-frontend/src/components/ui/JavaSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ import { auto_install_java, find_filtered_jres, get_jre, test_jre } from '@/help
import { ref } from 'vue'
import { open } from '@tauri-apps/plugin-dialog'
import JavaDetectionModal from '@/components/ui/JavaDetectionModal.vue'
import { mixpanel_track } from '@/helpers/mixpanel'
import { handleError } from '@/store/state.js'
import { trackEvent } from '@/helpers/analytics'
const props = defineProps({
version: {
Expand Down Expand Up @@ -113,7 +113,7 @@ async function testJava() {
)
testingJava.value = false
mixpanel_track('JavaTest', {
trackEvent('JavaTest', {
path: props.modelValue ? props.modelValue.path : '',
success: testingJavaSuccess.value,
})
Expand All @@ -136,7 +136,7 @@ async function handleJavaFileInput() {
}
}
mixpanel_track('JavaManualSelect', {
trackEvent('JavaManualSelect', {
path: filePath,
version: props.version,
})
Expand Down Expand Up @@ -170,7 +170,7 @@ async function reinstallJava() {
}
}
mixpanel_track('JavaReInstall', {
trackEvent('JavaReInstall', {
path: path,
version: props.version,
})
Expand Down
4 changes: 2 additions & 2 deletions apps/app-frontend/src/components/ui/RunningAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ import { useRouter } from 'vue-router'
import { progress_bars_list } from '@/helpers/state.js'
import ProgressBar from '@/components/ui/ProgressBar.vue'
import { handleError } from '@/store/notifications.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { ChatIcon } from '@/assets/icons'
import { get_many } from '@/helpers/profile.js'
import { trackEvent } from '@/helpers/analytics'
const router = useRouter()
const card = ref(null)
Expand Down Expand Up @@ -164,7 +164,7 @@ const stop = async (process) => {
try {
await killProcess(process.uuid).catch(handleError)
mixpanel_track('InstanceStop', {
trackEvent('InstanceStop', {
loader: process.profile.loader,
game_version: process.profile.game_version,
source: 'AppBar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import { formatCategory } from '@modrinth/utils'
import { add_project_from_version as installMod } from '@/helpers/profile'
import { ref } from 'vue'
import { handleError, useTheming } from '@/store/state.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { trackEvent } from '@/helpers/analytics'
const themeStore = useTheming()
Expand All @@ -87,7 +87,7 @@ defineExpose({
incompatibleModal.value.show()
mixpanel_track('ProjectInstallStart', { source: 'ProjectIncompatibilityWarningModal' })
trackEvent('ProjectInstallStart', { source: 'ProjectIncompatibilityWarningModal' })
},
})
Expand All @@ -98,7 +98,7 @@ const install = async () => {
onInstall.value(selectedVersion.value.id)
incompatibleModal.value.hide()
mixpanel_track('ProjectInstall', {
trackEvent('ProjectInstall', {
loader: instance.value.loader,
game_version: instance.value.game_version,
id: project.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { XIcon, DownloadIcon } from '@modrinth/assets'
import { Button, Modal } from '@modrinth/ui'
import { install as pack_install } from '@/helpers/pack'
import { ref } from 'vue'
import { mixpanel_track } from '@/helpers/mixpanel'
import { trackEvent } from '@/helpers/analytics'
import { useTheming } from '@/store/theme.js'
import { handleError } from '@/store/state.js'
Expand All @@ -25,7 +25,7 @@ defineExpose({
onInstall.value = callback
mixpanel_track('PackInstallStart')
trackEvent('PackInstallStart')
},
})
Expand All @@ -39,7 +39,7 @@ async function install() {
project.value.title,
project.value.icon_url,
).catch(handleError)
mixpanel_track('PackInstall', {
trackEvent('PackInstall', {
id: project.value.id,
version_id: versionId.value,
title: project.value.title,
Expand Down
Loading

0 comments on commit a27b5f4

Please sign in to comment.