Skip to content

Commit

Permalink
Merge pull request #27 from DIDIRUS4/feature-0
Browse files Browse the repository at this point in the history
  • Loading branch information
DIDIRUS4 authored Jul 19, 2024
2 parents a0fa62d + f93b3dd commit c5d19de
Show file tree
Hide file tree
Showing 12 changed files with 464 additions and 344 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CI
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
merge_group:
types: [ checks_requested ]
# pull_request:
# types: [opened, synchronize]
# merge_group:
# types: [ checks_requested ]

jobs:
build:
Expand Down
1 change: 0 additions & 1 deletion apps/app-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"floating-vue": "^5.2.2",
"mixpanel-browser": "^2.53.0",
"ofetch": "^1.3.4",
"omorphia": "^0.7.3",
"pinia": "^2.1.7",
"tauri-plugin-window-state-api": "github:tauri-apps/tauri-plugin-window-state#v1",
"vite-svg-loader": "^5.1.0",
Expand Down
70 changes: 70 additions & 0 deletions apps/app-frontend/src/components/ui/AddContentButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script setup lang="ts">
import { DropdownIcon, FolderOpenIcon, SearchIcon } from '@modrinth/assets'
import { Button, OverflowMenu } from '@modrinth/ui'
import { open } from '@tauri-apps/api/dialog'
import { add_project_from_path, get } from '@/helpers/profile.js'
import { handleError } from '@/store/notifications.js'
import { useRouter } from 'vue-router'
import { i18n } from '@/main.js'
const t = i18n.global.t
const props = defineProps({
instance: {
type: Object,
required: true,
},
})
const router = useRouter()
const handleAddContentFromFile = async () => {
const newProject = await open({ multiple: true })
if (!newProject) return
for (const project of newProject) {
await add_project_from_path(props.instance.path, project, 'mod').catch(handleError)
}
props.instance.initProjects(await get(props.instance.path).catch(handleError))
}
const handleSearchContent = async () => {
await router.push({
path: `/browse/${props.instance.metadata.loader === 'vanilla' ? 'datapack' : 'mod'}`,
query: { i: props.instance.path },
})
}
</script>

<template>
<div class="joined-buttons">
<Button color="primary" @click="handleSearchContent"
><SearchIcon /> {{ t('Instance.Mods.AddContent') }}
</Button>

<OverflowMenu
:options="[
{
id: 'search',
action: () => handleSearchContent,
},
{
id: 'from_file',
action: () => handleAddContentFromFile,
},
]"
class="btn btn-primary btn-dropdown-animation icon-only"
>
<DropdownIcon />
<template #search>
<SearchIcon />
<span class="no-wrap"> {{t('Instance.Mods.Search')}} </span>
</template>
<template #from_file>
<FolderOpenIcon />
<span class="no-wrap"> {{ t('Instance.Mods.AddFile') }} </span>
</template>
</OverflowMenu>
</div>
</template>
2 changes: 1 addition & 1 deletion apps/app-frontend/src/components/ui/ModInstallModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const check_valid = computed(() => {
<div class="profiles" :class="{ 'hide-creation': !showCreation }">
<div v-for="profile in profiles" :key="profile.metadata.name" class="option">
<Button
color="raised"
transparent
class="profile-button"
@click="$router.push(`/instance/${encodeURIComponent(profile.path)}`)"
>
Expand Down
16 changes: 8 additions & 8 deletions apps/app-frontend/src/components/ui/RunningAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,16 @@ await getRemote(true, false)
.icon-button {
background-color: rgba(0, 0, 0, 0);
box-shadow: none;
width: 1.25rem !important;
height: 1.25rem !important;
padding: 0 !important;
}
.stop {
color: var(--color-red);
}
svg {
min-width: 1.25rem;
}
.utility {
color: var(--color-contrast);
&.stop {
color: var(--color-red);
}
}
.info-card {
Expand Down
104 changes: 22 additions & 82 deletions apps/app-frontend/src/pages/instance/Mods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,7 @@
<UpdatedIcon />
{{t('Instance.Mods.UpdateAll')}}
</Button>


<!-- TODO: Check later... -->
<div v-if="!isPackLocked" class="joined-buttons">
<Button color="primary" @click="onSearchContent">
<SearchIcon />
{{t('Instance.Mods.AddContent')}}
</Button>
<OverflowMenu
:options="[
{
id: 'file',
action: onFileContent,
},
]"
class="btn btn-primary btn-dropdown-animation icon-only"
>
<DropdownIcon />
<template #file>
<FolderOpenIcon />
{{t('Instance.Mods.AddFile')}}
</template>
</OverflowMenu>
</div>


<AddContentButton v-if="!isPackLocked" :instance="instance" />
</Card>
<Pagination
v-if="projects.length > 0"
Expand Down Expand Up @@ -249,7 +224,7 @@
<TrashIcon />
</Button>
</div>
<AnimatedLogo v-if="mod.updating" class="btn icon-only loading-indicator" ></AnimatedLogo>
<AnimatedLogo v-if="mod.updating" class="btn icon-only updating-indicator" />
<div
v-else
v-tooltip="isPackLocked ? t('Instance.Mods.UnlockThisInstanceUpdate') : t('Instance.Mods.UpdateProject')"
Expand Down Expand Up @@ -289,29 +264,9 @@
<div class="empty-icon">
<AddProjectImage />
</div>
<h3>{{t('Instance.Mods.NoProjectsFound')}}</h3>
<p class="empty-subtitle">{{t('Instance.Mods.NoProjectFoundDesc')}}</p>
<div v-if="!isPackLocked" class="joined-buttons">
<Button color="primary" @click="onSearchContent">
<SearchIcon />
{{t('Instance.Mods.AddContent')}}
</Button>
<OverflowMenu
:options="[
{
id: 'file',
action: onFileContent,
},
]"
class="btn btn-primary btn-dropdown-animation icon-only"
>
<DropdownIcon />
<template #file>
<FolderOpenIcon />
{{t('Instance.Mods.AddFile')}}
</template>
</OverflowMenu>
</div>
<h3>No projects found</h3>
<p class="empty-subtitle">Add a project to get started</p>
<AddContentButton :instance="instance" />
</div>
<Pagination
v-if="projects.length > 0"
Expand Down Expand Up @@ -405,7 +360,6 @@ import {
} from '@modrinth/ui'
import { formatProjectType } from '@modrinth/utils'
import { computed, onUnmounted, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import {
add_project_from_path,
get,
Expand All @@ -416,16 +370,15 @@ import {
} from '@/helpers/profile.js'
import { handleError } from '@/store/notifications.js'
import { mixpanel_track } from '@/helpers/mixpanel'
import { open } from '@tauri-apps/api/dialog'
import { listen } from '@tauri-apps/api/event'
import { convertFileSrc } from '@tauri-apps/api/tauri'
import { highlightModInProfile } from '@/helpers/utils.js'
import { MenuIcon, ToggleIcon, TextInputIcon, AddProjectImage, PackageIcon } from '@/assets/icons'
import ExportModal from '@/components/ui/ExportModal.vue'
import ModpackVersionModal from '@/components/ui/ModpackVersionModal.vue'
import AddContentButton from '@/components/ui/AddContentButton.vue'
import { i18n } from '@/main.js';
const t = i18n.global.t;
const router = useRouter()
const props = defineProps({
instance: {
Expand Down Expand Up @@ -869,23 +822,6 @@ const handleRightClick = (event, mod) => {
}
}
const onSearchContent = async () => {
await router.push({
path: `/browse/${props.instance.metadata.loader === 'vanilla' ? 'datapack' : 'mod'}`,
query: { i: props.instance.path },
})
}
const onFileContent = async () => {
const newProject = await open({ multiple: true })
if (!newProject) return
for (const project of newProject) {
await add_project_from_path(props.instance.path, project, 'mod').catch(handleError)
}
initProjects(await get(props.instance.path).catch(handleError))
}
watch(selectAll, () => {
for (const [key, value] of Array.from(selectionMap.value)) {
if (value !== selectAll.value) {
Expand Down Expand Up @@ -984,17 +920,9 @@ onUnmounted(() => {
white-space: nowrap;
align-items: center;
:deep {
.popup-container {
.btn {
height: 2.5rem !important;
}
}
.dropdown-row {
.btn {
height: 2.5rem !important;
}
:deep(.dropdown-row) {
.btn {
height: 2.5rem !important;
}
}
Expand All @@ -1005,6 +933,14 @@ onUnmounted(() => {
.dropdown-input {
flex-grow: 1;
.animated-dropdown {
width: unset;
:deep(.selected) {
border-radius: var(--radius-md) 0 0 var(--radius-md);
}
}
.iconified-input {
width: 100%;
Expand Down Expand Up @@ -1190,8 +1126,12 @@ onUnmounted(() => {
</style>
<style lang="scss">
.updating-indicator {
height: 2.25rem !important;
width: 2.25rem !important;
svg {
margin-left: 0.5rem !important;
height: 1.25rem !important;
width: 1.25rem !important;
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/app/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
}
},
"security": {
"csp": "default-src 'self'; connect-src https://api.github.com https://modrinth.com https://*.modrinth.com https://mixpanel.com https://*.mixpanel.com https://*.cloudflare.com https://api.mclo.gs; font-src https://cdn-raw.modrinth.com/fonts/inter/; img-src tauri: https: data: blob: asset: https://asset.localhost; script-src https://*.cloudflare.com 'self' 'unsafe-eval' 'sha256-qI6/iDpFRcrQvD88dpuloNxSy8DwdlZzYyHGlvNwjYU=' 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='; frame-src https://*.cloudflare.com https://www.youtube.com 'self'; style-src 'self' 'unsafe-inline';"
"csp": "default-src 'self'; connect-src https://api.github.com https://modrinth.com https://*.modrinth.com https://mixpanel.com https://*.mixpanel.com https://*.cloudflare.com https://api.mclo.gs; font-src https://cdn-raw.modrinth.com/fonts/inter/; img-src tauri: https: data: blob: asset: https://asset.localhost; script-src https://*.cloudflare.com 'self' 'unsafe-eval' 'sha256-qI6/iDpFRcrQvD88dpuloNxSy8DwdlZzYyHGlvNwjYU=' 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='; frame-src https://*.cloudflare.com https://www.youtube.com 'self'; style-src 'self' ''unsafe-inline'';"
},
"updater": {
"active": false
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"version": "0.0.0",
"private": true,
"scripts": {
"web:build": "turbo run build --filter=@modrinth/frontend",
"pages:build": "NITRO_PRESET=cloudflare-pages pnpm --filter frontend run build",
"web:dev": "turbo run dev --filter=@modrinth/frontend",
"web:build": "turbo run build --filter=@modrinth/frontend",
"app:dev": "turbo run dev --filter=@modrinth/app",
"app:build": "turbo run build --filter=@modrinth/app",
"pages:build": "NITRO_PRESET=cloudflare-pages pnpm --filter frontend run build",
"build": "turbo run build --continue",
"lint": "turbo run lint --continue",
"test": "turbo run test --continue"
},
"devDependencies": {
"prettier": "^3.3.2",
"turbo": "^2.0.6",
"vue": "^3.4.31"
"prettier": "^3.3.3",
"turbo": "^2.0.7",
"vue": "^3.4.32"
},
"packageManager": "[email protected]",
"pnpm": {
Expand Down
17 changes: 12 additions & 5 deletions packages/assets/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ html {
--dark-color-base: #b0bac5;
--dark-color-contrast: #ecf9fb;

--color-ad: rgba(125, 75, 162, 0.2);
--color-ad-raised: rgba(190, 140, 243, 0.5);
--color-ad-contrast: black;
--color-ad-highlight: var(--color-purple);

--gap-xs: 0.25rem;
--gap-sm: 0.5rem;
--gap-md: 0.75rem;
Expand Down Expand Up @@ -60,6 +55,11 @@ html {

--color-tooltip-text: var(--color-accent-contrast);
--color-tooltip-bg: var(--color-base);

--color-ad: #d6e6f9;
--color-ad-raised: #b1c8e4;
--color-ad-contrast: var(--color-text);
--color-ad-highlight: #088cdb;
}

.dark-mode,
Expand Down Expand Up @@ -98,11 +98,18 @@ html {

--color-tooltip-text: var(--color-base);
--color-tooltip-bg: var(--color-button-bg);

--color-ad: #1f324a;
--color-ad-raised: #2e4057;
--color-ad-contrast: var(--color-text);
--color-ad-highlight: #088cdb;
}

.oled-mode {
@extend .dark-mode;
--color-bg: #000000;
--color-raised-bg: #101013;
--color-button-bg: #222329;

--color-ad: #0d1828;
}
Loading

0 comments on commit c5d19de

Please sign in to comment.