Skip to content

Commit

Permalink
chore: Format & Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbiros committed Jul 18, 2024
1 parent cb369a5 commit c87f3ff
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion apps/app-frontend/src/components/ui/ExportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const initFiles = async () => {
disabled:
folder === 'profile.json' ||
folder.startsWith('modrinth_logs') ||
folder.startsWith('.fabric')
folder.startsWith('.fabric'),
}))
.filter((pathData) => !pathData.path.includes('.DS_Store'))
.forEach((pathData) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/app-frontend/src/components/ui/InstanceCreationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ const create_instance = async () => {
creating.value = true
const loader_version_value =
loader_version.value === 'other' ? specified_loader_version.value : loader_version.value
const loaderVersion = loader.value === 'vanilla' ? null : loader_version_value ?? 'stable'
const loaderVersion = loader.value === 'vanilla' ? null : (loader_version_value ?? 'stable')
hide()
creating.value = false
Expand All @@ -362,7 +362,7 @@ const create_instance = async () => {
profile_name.value,
game_version.value,
loader.value,
loader.value === 'vanilla' ? null : loader_version_value ?? 'stable',
loader.value === 'vanilla' ? null : (loader_version_value ?? 'stable'),
icon.value,
).catch(handleError)
Expand Down
2 changes: 1 addition & 1 deletion apps/app-frontend/src/components/ui/ProjectCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const install = async (e) => {
<div
class="banner"
:style="{
'background-color': project.featured_gallery ?? project.gallery[0] ? null : toColor,
'background-color': (project.featured_gallery ?? project.gallery[0]) ? null : toColor,
'background-image': `url(${
project.featured_gallery ??
project.gallery[0] ??
Expand Down
1 change: 0 additions & 1 deletion apps/app-frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import App from '@/App.vue'
import { createPinia } from 'pinia'
import '@modrinth/assets/omorphia.scss'
import '@/assets/stylesheets/global.scss'
import 'floating-vue/dist/style.css'
import FloatingVue from 'floating-vue'
import 'floating-vue/dist/style.css'
import { get_opening_command, initialize_state } from '@/helpers/state'
Expand Down
14 changes: 6 additions & 8 deletions apps/app-frontend/src/pages/Browse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,12 @@ const [categories, loaders, availableGameVersions] = await Promise.all([
])
const filteredLoaders = computed(() => {
return loaders.value.filter(loader => {
return (projectType.value === 'mod' || projectType.value === 'modpack')
return loaders.value.filter((loader) => {
return projectType.value === 'mod' || projectType.value === 'modpack'
? loader.supported_project_types[0] === 'mod'
: loader.supported_project_types[0] === projectType.value;
});
});
: loader.supported_project_types[0] === projectType.value
})
})
const selectableProjectTypes = computed(() => {
const values = [
Expand Down Expand Up @@ -527,9 +527,7 @@ const showVersions = computed(
() => instanceContext.value === null || ignoreInstanceGameVersions.value,
)
const isModProject = computed(
() => ['modpack', 'mod'].includes(projectType.value)
)
const isModProject = computed(() => ['modpack', 'mod'].includes(projectType.value))
onUnmounted(() => unlistenOffline())
</script>
Expand Down
9 changes: 6 additions & 3 deletions apps/app-frontend/src/pages/instance/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ import { createVirtualScroller } from 'vue-typed-virtual-list'
dayjs.extend(isToday)
dayjs.extend(isYesterday)
const VirtualScroller = createVirtualScroller();
const VirtualScroller = createVirtualScroller()
const route = useRoute()
Expand Down Expand Up @@ -412,8 +412,11 @@ function handleUserScroll() {
interval.value = setInterval(async () => {
if (logs.value.length > 0) {
logs.value[0] = await getLiveStdLog()
const logContainerElement = logContainer.value.$el;
const scroll = logContainerElement.scrollHeight - logContainerElement.scrollTop - logContainerElement.clientHeight
const logContainerElement = logContainer.value.$el
const scroll =
logContainerElement.scrollHeight -
logContainerElement.scrollTop -
logContainerElement.clientHeight
// const scroll = logContainer.value.$el.scrollHeight - logContainer.value.$el.scrollTop - logContainer.value.$el.clientHeight
// Allow resetting of userScrolled if the user scrolls to the bottom
Expand Down
8 changes: 3 additions & 5 deletions apps/app/src/api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub async fn should_disable_mouseover() -> bool {
}

#[tauri::command]
pub fn show_in_folder(path: PathBuf) -> Result<()> {
pub fn show_in_folder(mut path: PathBuf) -> Result<()> {
{
#[cfg(target_os = "windows")]
{
Expand All @@ -100,17 +100,15 @@ pub fn show_in_folder(path: PathBuf) -> Result<()> {
#[cfg(target_os = "linux")]
{
use std::fs::metadata;
use std::path::PathBuf;

let path_string = path.to_string_lossy().to_string();

if metadata(&path)?.is_dir() {
Command::new("xdg-open").arg(&path).spawn()?;
} else if path_string.contains(',') {
// see https://gitlab.freedesktop.org/dbus/dbus/-/issues/76
let mut parent_path = PathBuf::from(path);
parent_path.pop();
Command::new("xdg-open").arg(&parent_path).spawn()?;
path.pop();
Command::new("xdg-open").arg(&path).spawn()?;
} else {
Command::new("dbus-send")
.args([
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/pages/dashboard/revenue/withdraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ const getRangeOfMethod = (method) => {
const maxWithdrawAmount = computed(() => {
const interval = selectedMethod.value.interval;
return interval?.standard ? interval.standard.max : interval?.fixed?.values.slice(-1)[0] ?? 0;
return interval?.standard ? interval.standard.max : (interval?.fixed?.values.slice(-1)[0] ?? 0);

Check failure on line 261 in apps/frontend/src/pages/dashboard/revenue/withdraw.vue

View workflow job for this annotation

GitHub Actions / Build, Test, and Lint

Replace `(interval?.fixed?.values.slice(-1)[0]·??·0)` with `interval?.fixed?.values.slice(-1)[0]·??·0`
});
const minWithdrawAmount = computed(() => {
const interval = selectedMethod.value.interval;
return interval?.standard ? interval.standard.min : interval?.fixed?.values?.[0] ?? fees.value;
return interval?.standard ? interval.standard.min : (interval?.fixed?.values?.[0] ?? fees.value);

Check failure on line 266 in apps/frontend/src/pages/dashboard/revenue/withdraw.vue

View workflow job for this annotation

GitHub Actions / Build, Test, and Lint

Replace `(interval?.fixed?.values?.[0]·??·fees.value)` with `interval?.fixed?.values?.[0]·??·fees.value`
});
const withdrawAccount = computed(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/app-lib/src/state/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ impl From<InnerProjectPathUnix> for RawProjectPath {
pub struct ProjectPathId(pub PathBuf);
impl ProjectPathId {
// Create a new ProjectPathId from a full file path
pub async fn from_fs_path(path: &PathBuf) -> crate::Result<Self> {
pub async fn from_fs_path(path: &Path) -> crate::Result<Self> {
// This is avoiding dunce::canonicalize deliberately. On Windows, paths will always be convert to UNC,
// but this is ok because we are stripping that with the prefix. Using std::fs avoids different behaviors with dunce that
// come with too-long paths
let profiles_dir: PathBuf = std::fs::canonicalize(
State::get().await?.directories.profiles_dir().await,
)?;
// Normal canonizing resolves symlinks, which results in "path not corresponding to profile" error
let path = path::absolute(path.to_path_buf())?;
let path = path::absolute(path)?;
let path = path
.strip_prefix(profiles_dir)
.ok()
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/base/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ const props = withDefaults(defineProps<Props>(), {
const currentValue = ref(Math.max(props.min, props.modelValue))
const inputValueValid = (inputValue: number) => {
let newValue = inputValue || props.min;
let newValue = inputValue || props.min
if (props.forceStep) {
newValue -= newValue % props.step;
newValue -= newValue % props.step
}
newValue = Math.max(props.min, Math.min(newValue, props.max));
newValue = Math.max(props.min, Math.min(newValue, props.max))
currentValue.value = newValue
emit('update:modelValue', currentValue.value)
Expand Down
13 changes: 8 additions & 5 deletions packages/ui/src/components/modal/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const props = defineProps({
openInNewTab: {
type: Boolean,
default: true,
}
},
})
const shareModal = ref(null)
Expand Down Expand Up @@ -94,9 +94,7 @@ const sendEmail = computed(
&body=${encodeURIComponent(content.value)}`,
)
const targetParameter = computed(
() => props.openInNewTab ? "_blank" : "_self"
)
const targetParameter = computed(() => (props.openInNewTab ? '_blank' : '_self'))
const sendTweet = computed(
() => `https://twitter.com/intent/tweet?text=${encodeURIComponent(content.value)}`,
Expand Down Expand Up @@ -145,7 +143,12 @@ defineExpose({
<Button v-if="canShare" v-tooltip="'Share'" icon-only @click="share">
<ShareIcon />
</Button>
<a v-tooltip="'Send as an email'" class="btn icon-only" :href="sendEmail" :target="targetParameter">
<a
v-tooltip="'Send as an email'"
class="btn icon-only"
:href="sendEmail"
:target="targetParameter"
>
<MailIcon />
</a>
<a
Expand Down

0 comments on commit c87f3ff

Please sign in to comment.