Skip to content

Commit

Permalink
#695 Add Dao Core dapp icon in sidemenu - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
echoby committed Jul 12, 2021
1 parent 1a72649 commit b811526
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 10 deletions.
12 changes: 10 additions & 2 deletions ui/view/applications.qml
Expand Up @@ -16,6 +16,7 @@ ColumnLayout {
property bool hasApps: !!appsList && appsList.length > 0
property string errorMessage: ""
property var activeApp: undefined
property string appCmd: ""

ApplicationsViewModel {
id: viewModel
Expand Down Expand Up @@ -493,9 +494,16 @@ ColumnLayout {

Component.onCompleted: {
if (settings.dappsAllowed) {
loadAppsList()
if (appCmd.length && appCmd == "daocore") {
// TODO(chapati): load daocore from here
// https://github.com/BeamMW/beam-ui/issues/695
console.log("open daocore");
loadAppsList();
} else {
loadAppsList();
}
} else {
appsDialog.open()
appsDialog.open();
}
}
}
15 changes: 15 additions & 0 deletions ui/view/assets/icon-daocore-active.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ui/view/assets/icon-daocore.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 22 additions & 8 deletions ui/view/main.qml
Expand Up @@ -153,15 +153,17 @@ Rectangle {
}

property var contentItems : [
{name: "wallet"},
{name: "wallet"},
{name: "atomic_swap"},
// {name: "dex"},
{name: "addresses"},
{name: "addresses"},
{name: "notifications"},
{name: "applications", qml: function () {
return BeamGlobals.isFork3() ? "applications" : "applications_nofork"
}}
]
{name: "applications", qml: function () {
return BeamGlobals.isFork3() ? "applications" : "applications_nofork"
}
},
{name: "daocore"}
]

property int selectedItem

Expand Down Expand Up @@ -358,14 +360,26 @@ Rectangle {
var update = function(index) {
selectedItem = index;
var source = "";
var args = Object.assign({"openSend": false}, props);
if (index >= 0) {
controls.itemAt(index).focus = true;

source = ["qrc:/", contentItems[index].qml ? contentItems[index].qml() : contentItems[index].name, ".qml"].join('')
function isApp(element, index, array) {
return element.qml && (contentItems[index].qml() == "applications" || contentItems[index].qml() == "applications_nofork");
}

var appIndex = contentItems.findIndex(isApp);
if (appIndex >= 0 && index > appIndex) {
source = "qrc:/applications.qml";
args = Object.assign({"appCmd": contentItems[index].name}, args);
} else {
source = ["qrc:/", contentItems[index].qml ? contentItems[index].qml() : contentItems[index].name, ".qml"].join('');
}

} else if (index == -1) {
source = "qrc:/settings.qml";
}
content.setSource(source, Object.assign({"openSend": false}, props))
content.setSource(source, args)

viewModel.update(index)
}
Expand Down
2 changes: 2 additions & 0 deletions ui/view/qml.qrc
Expand Up @@ -347,5 +347,7 @@
<file>assets/bg-pic@3x.png</file>
<file>controls/VersionFooter.qml</file>
<file>assets/icon-go-to-app.svg</file>
<file>assets/icon-daocore.svg</file>
<file>assets/icon-daocore-active.svg</file>
</qresource>
</RCC>

0 comments on commit b811526

Please sign in to comment.