Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Popup.vue « App « vue « src - github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aaf5fb8f69ad71944b7d502b02cfbc762ab8b7a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<template>
    <div id="manager">
        <tabs :tabs="tabs" :initial-tab="tab" ref="tabs" v-on:switch="saveTab($event)" v-if="authorized">
            <related slot="related" v-on:search="searchEvent"/>
            <search slot="search"/>
            <browse slot="browse"/>
            <collected slot="collected" :initial-status="collected"/>
            <tools slot="tools"/>
        </tabs>
        <authorisation v-if="!authorized"></authorisation>
        <first-run-wizard v-if="firstRun"/>
        <div id="toasts"></div>
    </div>
</template>

<script>
    import Tabs from '@vue/Components/Tabs';
    import Tools from '@vue/Components/Popup/Tools';
    import Browse from '@vue/Components/Popup/Browse';
    import Search from '@vue/Components/Popup/Search';
    import Related from '@vue/Components/Popup/Related';
    import Authorisation from '@vue/Components/Popup/Authorisation';
    import Collected from '@vue/Components/Popup/Collected';
    import PopupStateService from "@js/Services/PopupStateService";

    export default {
        el        : '#app',
        components: {
            Tools,
            Collected,
            Authorisation,
            Related,
            Search,
            Browse,
            Tabs,
            'first-run-wizard': () => import (/* webpackChunkName: "FirstRunWizard" */'@vue/Components/Firstrun/FirstRunWizard')
        },

        props: {
            collected: {
                type   : Object,
                default: () => {
                    return {
                        current: null
                    };
                }
            }
        },

        computed: {
            tab() {
                return PopupStateService.getTab();
            },
            firstRun() {
                return PopupStateService.getStatus('firstRun');
            },
            authorized() {
                return PopupStateService.getStatus('authorized');
            },
            tabs() {
                return {
                    related  : {
                        icon : 'key',
                        label: 'TabRelated'
                    },
                    search   : {
                        icon : 'search',
                        label: 'TabSearch'
                    },
                    browse   : {
                        icon : 'server',
                        label: 'TabBrowse'
                    },
                    collected: {
                        icon : 'history',
                        label: 'TabCollected'
                    },
                    tools    : {
                        icon : 'tools',
                        label: 'TabTools'
                    }
                };
            }
        },

        methods: {
            saveTab($event) {
                PopupStateService.setTab($event.tab);
            },
            searchEvent($event) {
                this.$refs.tabs.setActive('search');
                setTimeout(() => document.getElementById('query').value += $event, 10);
            }
        }
    };
</script>

<style lang="scss">
@import "@scss/includes";
@import "@scssP/browser.scss";

body {
    overflow : hidden;

    &.mobile {
        width  : 100vw;
        height : 100vh;
    }

    &.desktop {
        width  : 360px;
        height : 360px;
    }
}

#manager {
    width    : 100vw;
    height   : 100vh;
    display  : block;
    overflow : hidden;

    > .tab-container > .tabs .tab {
        overflow    : hidden;
        width       : calc(100vw - 12rem);
        transition  : var(--popup-tab-transition);
        box-sizing  : border-box;
        box-shadow  : var(--main-tab-border);
        flex-shrink : 0;

        .label {
            opacity    : 1;
            transition : var(--fade-transition);
        }

        &:not(.active) {
            width     : 3rem;
            flex-grow : 0;

            .label {
                opacity : 0;
            }
        }

        &.active {
            box-shadow : var(--main-tab-active-border);
        }
    }

    > .tab-container > .tab-content {
        max-height      : calc(100vh - 3rem - 2px);
        overflow        : auto;
        scrollbar-width : thin;
        scrollbar-color : var(--element-active-fg-color) var(--element-active-bg-color);
    }

    @media screen and (min-aspect-ratio : 13/9) {
        > .tab-container {
            display               : grid;
            grid-template-columns : 3rem 1fr;
            height                : 100vh;

            > .tabs {
                display      : block;
                border-right : 1px solid var(--element-hover-bg-color);

                > .tab {
                    &.active {
                        box-shadow : var(--main-tab-mobile-active-border);

                        .label {
                            opacity : 0;
                        }
                    }
                }
            }

            > .tab-content {
                max-height : 100vh;
            }
        }
    }
}
</style>