Skip to content

Commit

Permalink
fix: update iframe theme
Browse files Browse the repository at this point in the history
  • Loading branch information
wushuangs committed Nov 8, 2024
1 parent 64db6b7 commit 52fd9fb
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 39 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- "main"
- "feat/app-service"

tags:
- 'v*'
Expand Down
14 changes: 7 additions & 7 deletions packages/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "quasar build -m pwa"
},
"dependencies": {
"@bytetrade/ui": "^0.1.15",
"@bytetrade/ui": "^0.1.28",
"@desktop/core": "0.1.0",
"@quasar/extras": "^1.16.7",
"@types/ua-parser-js": "0.7.36",
Expand Down
48 changes: 35 additions & 13 deletions packages/frontend/src/components/BasicWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
v-on:resizestop="resizeStop"
@click="onTop"
:stickSize="24"
class="iframe-box"
class="iframe-box bg-background-1"
:class="
isFull ? (value.isResizable ? 'animationClass' : 'animationClass2') : ''
"
Expand Down Expand Up @@ -125,7 +125,14 @@
</template>

<script lang="ts">
import { ref, defineComponent, onMounted, nextTick, onUnmounted } from 'vue';
import {
ref,
defineComponent,
onMounted,
nextTick,
onUnmounted,
watch
} from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
Expand Down Expand Up @@ -177,6 +184,7 @@ export default defineComponent({
const isFull = ref(false);
const clickNew = ref(false);
const $q = useQuasar();
const { locale } = useI18n();
const app_icon: string = value.value.icon;
Expand Down Expand Up @@ -266,18 +274,33 @@ export default defineComponent({
}
};
const message = (event: any) => {
if (event.data.message === 'theme_update') {
if (event.data.info.theme.toString() === '1') {
$q.dark.set(false);
} else {
$q.dark.set(true);
}
// const message = (event: any) => {
// if (event.data.message === 'theme_update') {
// if (event.data.info.theme.toString() === '1') {
// $q.dark.set(false);
// } else {
// $q.dark.set(true);
// }
// }
// };
watch(
() => locale,
() => {
iframeRef.value.contentWindow.postMessage(
{
message: 'theme_update',
info: {
theme: locale.value
}
},
'*'
);
}
};
);
onMounted(() => {
window.addEventListener('message', message);
// window.addEventListener('message', message);
nextTick(() => {
new MutationObserver(function (mutations) {
Expand Down Expand Up @@ -316,7 +339,7 @@ export default defineComponent({
});
onUnmounted(() => {
window.removeEventListener('message', message);
// window.removeEventListener('message', message);
});
return {
Expand Down Expand Up @@ -379,7 +402,6 @@ export default defineComponent({
.iframe-box {
box-shadow: 0 1px 5px rgb(0 0 0 / 20%), 0 2px 2px rgb(0 0 0 / 14%),
0 3px 1px -2px rgb(0 0 0 / 12%);
background: white;
border-radius: 10px;
.iframe-window {
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/components/ConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const onCancel = async () => {
}
.confirm {
width: 60px;
width: 68px;
text-align: center;
margin-top: 40px;
padding: 8px 12px;
Expand All @@ -128,10 +128,10 @@ const onCancel = async () => {
}
.cancel {
width: 60px;
width: 68px;
text-align: center;
margin-top: 40px;
padding: 8px 12px;
padding: 8px 0;
border-radius: 8px;
font-size: 12px;
line-height: 16px;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/i18n/zh-CN/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
file_no_data: '无匹配结果',
use_search: '使用 "{content}" 搜索...',
app: {
Files: '文件管理',
Files: '文件管理器',
Market: '应用市场',
Dashboard: '仪表盘',
Settings: '设置',
Expand Down
24 changes: 13 additions & 11 deletions packages/frontend/src/pages/LaunchPad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
appStore.desktopApps[element].icon,
appStore.desktopApps[element].title,
element,
indexList,
$event
)
"
Expand All @@ -94,6 +93,10 @@
:style="`
width:${appStore.DESKTOP_APP_SIZE}px;
height:${appStore.DESKTOP_APP_SIZE}px;
border-radius: ${borderRadiusFormat(
appStore.DESKTOP_APP_SIZE,
appStore.DESKTOP_APP_SIZE
)}px;
`"
v-if="
[
Expand All @@ -110,16 +113,22 @@
</svg>
</div>
<img
:key="appStore.desktopApps[element].title"
:src="appStore.desktopApps[element].icon"
:style="`width:${appStore.DESKTOP_APP_SIZE}px;height:${
appStore.DESKTOP_APP_SIZE
}px;border-radius: ${borderRadiusFormat(
appStore.DESKTOP_APP_SIZE,
appStore.DESKTOP_APP_SIZE
)}px;`"
)}px;${
appStore.desktopApps[element].state == 'suspend' ||
appStore.desktopApps[element].state == 'crash'
? 'filter: grayscale(100%) brightness(0.8)'
: 'filter: grayscale(0%)'
}`"
/>
<div
class="launch_pad_apps_name row items-center justify-center"
class="launch_pad_apps_name"
:data-index="appStore.desktopApps[element].id"
>
<span
Expand Down Expand Up @@ -323,7 +332,6 @@ function deleteLaunch(
icon: string,
launchTitle: string,
index: number,
indexList: number,
e: any
) {
console.log('deleteLaunch e', e);
Expand All @@ -340,15 +348,10 @@ function deleteLaunch(
}
}).onOk(async () => {
e.target.parentNode.classList.add('uninstallAni');
const fatherName = appStore.desktopApps[index].fatherName;
setTimeout(async () => {
const fatherName = appStore.desktopApps[index].fatherName;
let categoryLaunchPadApps = appStore.launchPadApps[indexList];
appStore.launchPadApps[indexList] = categoryLaunchPadApps.filter(
(item, itemIndex) => itemIndex !== index
);
await appStore.uninstall_application(fatherName);
await appStore.get_my_apps_info();
e.target.parentNode.classList.remove('uninstallAni');
}, 500);
});
Expand Down Expand Up @@ -670,7 +673,6 @@ const goto = (value: number) => {
background-position: center;
background-size: 100% 100%;
background-repeat: no-repeat;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/pages/mobile/BasicWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
ref="dragRef"
> -->
<div
class="iframe-box-mobile"
class="iframe-box-mobile bg-background-1"
:class="isFull ? 'animationClass-mobile' : ''"
:style="{
width: `${value.width}px`,
Expand Down Expand Up @@ -346,7 +346,6 @@ export default defineComponent({
.iframe-box-mobile {
box-shadow: 0 1px 5px rgb(0 0 0 / 20%), 0 2px 2px rgb(0 0 0 / 14%),
0 3px 1px -2px rgb(0 0 0 / 12%);
background: white;
border-radius: 10px;
overflow: hidden;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,13 @@ export const useAppStore = defineStore('app', {
if (!app_name) {
return;
}

this.myApps = this.myApps.filter((item) => item.fatherName !== app_name);
this.relocate_application_place(this.myApps);
const data: any = await axios.get(
tokenStore.url + '/server/uninstall/' + app_name,
{}
);
console.log(data);
}
}
});

0 comments on commit 52fd9fb

Please sign in to comment.