site-libsoc/Server/public/js/components/profile-component.js

599 lines
19 KiB
JavaScript
Raw Normal View History

2023-07-30 17:04:15 +07:00
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as setContext, o as onMount, J as afterUpdate, e as globals, f as element, h as space, n as noop, j as add_location, k as attr_dev, F as set_style, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js';
import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js';
import { svgFromObject } from '../../../../../../../../../js/libraries/miscTools.js';
import '../../../../../../../../../js/components/pane-aligner.js';
import '../../../../../../../../../js/components/profile-general.js';
import '../../../../../../../../../js/components/profile-groups.js';
/* src\profile\profile-component.svelte generated by Svelte v3.52.0 */
const { Object: Object_1 } = globals;
const file = "src\\profile\\profile-component.svelte";
function create_fragment(ctx) {
let div1;
let div0;
let p;
let t1;
let button0;
let t2;
let pane_aligner;
let div2;
let button1;
let object0;
let t3;
let span0;
let t5;
let button2;
let object1;
let t6;
let span1;
let t8;
let button3;
let object2;
let t9;
let span2;
let t11;
let button4;
let object3;
let t12;
let span3;
let t14;
let button5;
let object4;
let t15;
let span4;
let t17;
let button6;
let object5;
let t18;
let span5;
let t20;
let div3;
let profile_general;
let t21;
let profile_groups;
let t22;
let profile_communes;
let t23;
let profile_coops;
let t24;
let profile_parties;
let mounted;
let dispose;
const block = {
c: function create() {
div1 = element("div");
div0 = element("div");
p = element("p");
p.textContent = "wegwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww";
t1 = space();
button0 = element("button");
t2 = space();
pane_aligner = element("pane-aligner");
div2 = element("div");
button1 = element("button");
object0 = element("object");
t3 = space();
span0 = element("span");
span0.textContent = "general";
t5 = space();
button2 = element("button");
object1 = element("object");
t6 = space();
span1 = element("span");
span1.textContent = "groups";
t8 = space();
button3 = element("button");
object2 = element("object");
t9 = space();
span2 = element("span");
span2.textContent = "communes";
t11 = space();
button4 = element("button");
object3 = element("object");
t12 = space();
span3 = element("span");
span3.textContent = "cooperatives";
t14 = space();
button5 = element("button");
object4 = element("object");
t15 = space();
span4 = element("span");
span4.textContent = "parties";
t17 = space();
button6 = element("button");
object5 = element("object");
t18 = space();
span5 = element("span");
span5.textContent = "logout";
t20 = space();
div3 = element("div");
profile_general = element("profile-general");
t21 = space();
profile_groups = element("profile-groups");
t22 = space();
profile_communes = element("profile-communes");
t23 = space();
profile_coops = element("profile-coops");
t24 = space();
profile_parties = element("profile-parties");
this.c = noop;
add_location(p, file, 87, 8, 2264);
attr_dev(div0, "id", "location-overlay-content");
add_location(div0, file, 86, 4, 2219);
attr_dev(button0, "class", "overlay-button");
add_location(button0, file, 89, 4, 2326);
attr_dev(div1, "class", "overlay");
set_style(div1, "display", "none");
add_location(div1, file, 85, 0, 2144);
attr_dev(object0, "id", "general-img");
attr_dev(object0, "class", "icons");
attr_dev(object0, "type", "image/svg+xml");
attr_dev(object0, "data", "/img/profile/icons/general.svg");
attr_dev(object0, "title", "general");
add_location(object0, file, 95, 12, 2633);
add_location(span0, file, 96, 12, 2770);
add_location(button1, file, 94, 8, 2534);
attr_dev(object1, "id", "groups-img");
attr_dev(object1, "class", "icons");
attr_dev(object1, "type", "image/svg+xml");
attr_dev(object1, "data", "/img/common/groups.svg");
attr_dev(object1, "title", "groups");
add_location(object1, file, 99, 12, 2915);
add_location(span1, file, 100, 12, 3054);
add_location(button2, file, 98, 8, 2819);
attr_dev(object2, "id", "communes-img");
attr_dev(object2, "class", "icons");
attr_dev(object2, "type", "image/svg+xml");
attr_dev(object2, "data", "/img/common/communes.svg");
attr_dev(object2, "title", "communes");
add_location(object2, file, 103, 12, 3204);
add_location(span2, file, 104, 12, 3349);
add_location(button3, file, 102, 8, 3102);
attr_dev(object3, "id", "coops-img");
attr_dev(object3, "class", "icons");
attr_dev(object3, "type", "image/svg+xml");
attr_dev(object3, "data", "/img/common/coops.svg");
attr_dev(object3, "title", "coops");
add_location(object3, file, 107, 12, 3492);
add_location(span3, file, 108, 12, 3628);
add_location(button4, file, 106, 8, 3399);
attr_dev(object4, "id", "parties-img");
attr_dev(object4, "class", "icons");
attr_dev(object4, "type", "image/svg+xml");
attr_dev(object4, "data", "/img/common/parties.svg");
attr_dev(object4, "title", "parties");
add_location(object4, file, 111, 12, 3781);
add_location(span4, file, 112, 12, 3923);
add_location(button5, file, 110, 8, 3682);
attr_dev(object5, "id", "logout-img");
attr_dev(object5, "class", "icons");
attr_dev(object5, "type", "image/svg+xml");
attr_dev(object5, "data", "/img/profile/icons/logout.svg");
attr_dev(object5, "title", "");
add_location(object5, file, 115, 12, 4041);
add_location(span5, file, 116, 12, 4181);
attr_dev(button6, "id", "logout-button");
add_location(button6, file, 114, 8, 3972);
attr_dev(div2, "id", "left-column");
attr_dev(div2, "class", "pane");
attr_dev(div2, "slot", "sidebar-left");
add_location(div2, file, 93, 4, 2452);
set_style(profile_general, "display", "none");
add_location(profile_general, file, 120, 8, 4281);
set_style(profile_groups, "display", "none");
add_location(profile_groups, file, 121, 8, 4369);
set_style(profile_communes, "display", "none");
add_location(profile_communes, file, 122, 8, 4455);
set_style(profile_coops, "display", "none");
add_location(profile_coops, file, 123, 8, 4547);
set_style(profile_parties, "display", "none");
add_location(profile_parties, file, 124, 8, 4630);
attr_dev(div3, "id", "main-column");
attr_dev(div3, "slot", "main");
add_location(div3, file, 119, 4, 4237);
add_location(pane_aligner, file, 92, 0, 2432);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert_dev(target, div1, anchor);
append_dev(div1, div0);
append_dev(div0, p);
append_dev(div1, t1);
append_dev(div1, button0);
/*div1_binding*/ ctx[14](div1);
insert_dev(target, t2, anchor);
insert_dev(target, pane_aligner, anchor);
append_dev(pane_aligner, div2);
append_dev(div2, button1);
append_dev(button1, object0);
append_dev(button1, t3);
append_dev(button1, span0);
/*button1_binding*/ ctx[15](button1);
append_dev(div2, t5);
append_dev(div2, button2);
append_dev(button2, object1);
append_dev(button2, t6);
append_dev(button2, span1);
/*button2_binding*/ ctx[17](button2);
append_dev(div2, t8);
append_dev(div2, button3);
append_dev(button3, object2);
append_dev(button3, t9);
append_dev(button3, span2);
/*button3_binding*/ ctx[19](button3);
append_dev(div2, t11);
append_dev(div2, button4);
append_dev(button4, object3);
append_dev(button4, t12);
append_dev(button4, span3);
/*button4_binding*/ ctx[21](button4);
append_dev(div2, t14);
append_dev(div2, button5);
append_dev(button5, object4);
append_dev(button5, t15);
append_dev(button5, span4);
/*button5_binding*/ ctx[23](button5);
append_dev(div2, t17);
append_dev(div2, button6);
append_dev(button6, object5);
append_dev(button6, t18);
append_dev(button6, span5);
/*div2_binding*/ ctx[25](div2);
append_dev(pane_aligner, t20);
append_dev(pane_aligner, div3);
append_dev(div3, profile_general);
/*profile_general_binding*/ ctx[26](profile_general);
append_dev(div3, t21);
append_dev(div3, profile_groups);
/*profile_groups_binding*/ ctx[27](profile_groups);
append_dev(div3, t22);
append_dev(div3, profile_communes);
/*profile_communes_binding*/ ctx[28](profile_communes);
append_dev(div3, t23);
append_dev(div3, profile_coops);
/*profile_coops_binding*/ ctx[29](profile_coops);
append_dev(div3, t24);
append_dev(div3, profile_parties);
/*profile_parties_binding*/ ctx[30](profile_parties);
if (!mounted) {
dispose = [
listen_dev(button0, "click", /*click_handler*/ ctx[13], false, false, false),
listen_dev(button1, "click", /*click_handler_1*/ ctx[16], false, false, false),
listen_dev(button2, "click", /*click_handler_2*/ ctx[18], false, false, false),
listen_dev(button3, "click", /*click_handler_3*/ ctx[20], false, false, false),
listen_dev(button4, "click", /*click_handler_4*/ ctx[22], false, false, false),
listen_dev(button5, "click", /*click_handler_5*/ ctx[24], false, false, false),
listen_dev(button6, "click", AuthTools.logout, false, false, false)
];
mounted = true;
}
},
p: noop,
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div1);
/*div1_binding*/ ctx[14](null);
if (detaching) detach_dev(t2);
if (detaching) detach_dev(pane_aligner);
/*button1_binding*/ ctx[15](null);
/*button2_binding*/ ctx[17](null);
/*button3_binding*/ ctx[19](null);
/*button4_binding*/ ctx[21](null);
/*button5_binding*/ ctx[23](null);
/*div2_binding*/ ctx[25](null);
/*profile_general_binding*/ ctx[26](null);
/*profile_groups_binding*/ ctx[27](null);
/*profile_communes_binding*/ ctx[28](null);
/*profile_coops_binding*/ ctx[29](null);
/*profile_parties_binding*/ ctx[30](null);
mounted = false;
run_all(dispose);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment.name,
type: "component",
source: "",
ctx
});
return block;
}
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('profile-component', slots, []);
AuthTools.redirectNotLogged();
let root;
let general;
let groups;
let communes;
let coops;
let parties;
let panes;
let generalButton;
let groupsButton;
let communesButton;
let coopsButton;
let partiesButton;
let buttons;
let locationPopup;
let user = {};
AuthTools.getUser(user);
function changePane(pane, button) {
for (let p of panes) {
p.style.display = "none";
}
for (let b of buttons) {
styleField(b, 400, "#636363");
}
pane.style.display = "initial";
styleField(button, 500, "#c52a28");
}
function styleField(div, weight, color) {
div.style.fontWeight = weight;
let svgObject = div.querySelector("object");
let svgItem = svgFromObject(svgObject);
svgItem.setAttribute("fill", color);
}
function fillFields() {
if (Object.keys(user).length != 0 && root != undefined) {
for (let b of buttons) {
styleField(b, 400, "#636363");
}
styleField(generalButton, 500, "#c52a28");
} else {
setTimeout(fillFields, 100);
}
}
function showLocationOverlay() {
$$invalidate(11, locationPopup.style.display = "block", locationPopup);
}
setContext("profile-component", showLocationOverlay);
onMount(() => {
$$invalidate(1, general.user = user, general);
panes = [general, groups, communes, coops, parties];
buttons = [generalButton, groupsButton, communesButton, coopsButton, partiesButton];
fillFields();
$$invalidate(1, general.style.display = "initial", general);
});
const writable_props = [];
Object_1.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<profile-component> was created with unknown prop '${key}'`);
});
const click_handler = () => $$invalidate(11, locationPopup.style.display = "none", locationPopup);
function div1_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
locationPopup = $$value;
$$invalidate(11, locationPopup);
});
}
function button1_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
generalButton = $$value;
$$invalidate(6, generalButton);
});
}
const click_handler_1 = () => changePane(general, generalButton);
function button2_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
groupsButton = $$value;
$$invalidate(7, groupsButton);
});
}
const click_handler_2 = () => changePane(groups, groupsButton);
function button3_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
communesButton = $$value;
$$invalidate(8, communesButton);
});
}
const click_handler_3 = () => changePane(communes, communesButton);
function button4_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
coopsButton = $$value;
$$invalidate(9, coopsButton);
});
}
const click_handler_4 = () => changePane(coops, coopsButton);
function button5_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
partiesButton = $$value;
$$invalidate(10, partiesButton);
});
}
const click_handler_5 = () => changePane(parties, partiesButton);
function div2_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
root = $$value;
$$invalidate(0, root);
});
}
function profile_general_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
general = $$value;
$$invalidate(1, general);
});
}
function profile_groups_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
groups = $$value;
$$invalidate(2, groups);
});
}
function profile_communes_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
communes = $$value;
$$invalidate(3, communes);
});
}
function profile_coops_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
coops = $$value;
$$invalidate(4, coops);
});
}
function profile_parties_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
parties = $$value;
$$invalidate(5, parties);
});
}
$$self.$capture_state = () => ({
onMount,
afterUpdate,
setContext,
AuthTools,
svgFromObject,
root,
general,
groups,
communes,
coops,
parties,
panes,
generalButton,
groupsButton,
communesButton,
coopsButton,
partiesButton,
buttons,
locationPopup,
user,
changePane,
styleField,
fillFields,
showLocationOverlay
});
$$self.$inject_state = $$props => {
if ('root' in $$props) $$invalidate(0, root = $$props.root);
if ('general' in $$props) $$invalidate(1, general = $$props.general);
if ('groups' in $$props) $$invalidate(2, groups = $$props.groups);
if ('communes' in $$props) $$invalidate(3, communes = $$props.communes);
if ('coops' in $$props) $$invalidate(4, coops = $$props.coops);
if ('parties' in $$props) $$invalidate(5, parties = $$props.parties);
if ('panes' in $$props) panes = $$props.panes;
if ('generalButton' in $$props) $$invalidate(6, generalButton = $$props.generalButton);
if ('groupsButton' in $$props) $$invalidate(7, groupsButton = $$props.groupsButton);
if ('communesButton' in $$props) $$invalidate(8, communesButton = $$props.communesButton);
if ('coopsButton' in $$props) $$invalidate(9, coopsButton = $$props.coopsButton);
if ('partiesButton' in $$props) $$invalidate(10, partiesButton = $$props.partiesButton);
if ('buttons' in $$props) buttons = $$props.buttons;
if ('locationPopup' in $$props) $$invalidate(11, locationPopup = $$props.locationPopup);
if ('user' in $$props) user = $$props.user;
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [
root,
general,
groups,
communes,
coops,
parties,
generalButton,
groupsButton,
communesButton,
coopsButton,
partiesButton,
locationPopup,
changePane,
click_handler,
div1_binding,
button1_binding,
click_handler_1,
button2_binding,
click_handler_2,
button3_binding,
click_handler_3,
button4_binding,
click_handler_4,
button5_binding,
click_handler_5,
div2_binding,
profile_general_binding,
profile_groups_binding,
profile_communes_binding,
profile_coops_binding,
profile_parties_binding
];
}
class Profile_component extends SvelteElement {
constructor(options) {
super();
this.shadowRoot.innerHTML = `<style>@import '/css/common.css';#location-overlay-content{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:40rem;width:40rem;background:white;z-index:10000}.overlay{top:0;position:absolute;width:100%;height:100%;z-index:10000}.overlay-button{position:absolute;background:gray;opacity:0.5;width:100vw;height:100vh;z-index:1000}#general-img{top:0rem}#groups-img{top:0.3rem}#coops-img{top:0rem}#parties-img{top:0rem}#logout-img{width:1.5rem}#logout-button{padding-top:1rem;padding-left:0.1rem}#left-column{position:relative;display:flex;flex-direction:column;width:15.2rem;padding:2rem;border-radius:0.64rem 0.64rem 0.64rem 0.64rem;gap:1rem}.icons{position:relative;width:1.8rem}#left-column button span{position:absolute;padding-left:3.4rem;margin-top:0rem;font-family:var(--sans-serif,sans-serif)}#left-column button{display:flex;flex-direction:row}#main-column{padding:1rem 2rem 1rem 2rem;height:100%;width:100%;border-radius:0 0.64rem 0.64rem 0;flex-grow:1;flex-shrink:1;min-height:20rem}pane-aligner{--width-main:800px;--width-left:10.5rem}@media only screen and (max-width: 1340px){#left-column{position:relative;margin-left:0rem;width:100%;border-radius:0.64rem 0.64rem 0rem 0}#main-column{border-radius:0.64rem;padding:3rem 0.5rem;padding-bottom:1.5rem;border-radius:0rem 0rem 0.64rem 0.64rem;width:100%}#logout-button{position:relative;bottom:0}#left-column button{margin-left:auto;margin-right:auto;width:10rem}#logout-button{padding-top:1rem;margin-bottom:0rem}}</style>`;
init(
this,
{
target: this.shadowRoot,
props: attribute_to_object(this.attributes),
customElement: true
},
instance,
create_fragment,
safe_not_equal,
{},
null,
[-1, -1]
);
if (options) {
if (options.target) {
insert_dev(options.target, this, options.anchor);
}
}
}
}
customElements.define("profile-component", Profile_component);
export { Profile_component as default };