Skip to content

Commit

Permalink
Merge Sidebar and Topbar Review - Meeds-io/MIPs#159 (#4250)
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker authored Dec 9, 2024
2 parents 59fc2a0 + cec2456 commit 8f6ab77
Show file tree
Hide file tree
Showing 239 changed files with 10,811 additions and 3,127 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
/*
/**
* This file is part of the Meeds project (https://meeds.io/).
*
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.constant;

import * as spaceTemplateService from '../space-templates-management/js/SpaceTemplateService.js';

if (!Vue.prototype.$spaceTemplateService) {
window.Object.defineProperty(Vue.prototype, '$spaceTemplateService', {
value: spaceTemplateService,
});
public enum SidebarItemType {
PAGE, SITE, SEPARATOR, SPACES, SPACE_TEMPLATE, SPACE, LINK;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.constant;

public enum SidebarMode {
HIDDEN, ICON, STICKY;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.constant;

public enum TopbarItemType {
APP, LINK;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.model;

import lombok.Data;

@Data
public class NavigationConfiguration implements Cloneable {

private TopbarConfiguration topbar;

private SidebarConfiguration sidebar;

private final long lastModified;

public NavigationConfiguration() {
this.lastModified = System.currentTimeMillis();
}

public NavigationConfiguration(TopbarConfiguration topbar, SidebarConfiguration sidebar) {
this.topbar = topbar;
this.sidebar = sidebar;
this.lastModified = System.currentTimeMillis();
}

public NavigationConfiguration(TopbarConfiguration topbar,
SidebarConfiguration sidebar,
long lastModified) {
this.topbar = topbar;
this.sidebar = sidebar;
this.lastModified = lastModified;
}

@Override
public NavigationConfiguration clone() { // NOSONAR
return new NavigationConfiguration(topbar == null ? null : topbar.clone(),
sidebar == null ? null : sidebar.clone(),
lastModified);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.model;

import java.util.ArrayList;
import java.util.List;

import io.meeds.social.navigation.constant.SidebarMode;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SidebarConfiguration implements Cloneable {

private boolean allowUserCustomHome;

private SidebarMode defaultMode;

private SidebarMode userMode;

private List<SidebarMode> allowedModes;

private List<SidebarItem> items;

@Override
public SidebarConfiguration clone() { // NOSONAR
return new SidebarConfiguration(allowUserCustomHome,
defaultMode,
userMode,
allowedModes == null ? null : new ArrayList<>(allowedModes),
items == null ? null : items.stream().map(SidebarItem::clone).toList());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.meeds.social.navigation.constant.SidebarItemType;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SidebarItem implements Cloneable {

private String name;

private String url;

private String target;

private String avatar;

private String icon;

private SidebarItemType type;

private List<SidebarItem> items;

private Map<String, String> properties;

public SidebarItem(SidebarItemType type) {
this.type = type;
}

@Override
public SidebarItem clone() { // NOSONAR
return new SidebarItem(name,
url,
target,
avatar,
icon,
type,
items == null ? null : items.stream().map(SidebarItem::clone).toList(),
properties == null ? null : new HashMap<>(properties));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.model;

import java.util.Map;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import io.meeds.social.navigation.constant.TopbarItemType;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TopbarApplication {

public static final String CONTENT_ID_PROP_NAME = "contentId";

private String id;

private String name;

private String description;

private String icon;

private TopbarItemType type;

private boolean enabled;

private boolean mobile;

private Map<String, String> properties;

@Override
public boolean equals(Object o) {
if (!(o instanceof TopbarApplication app)) {
return false;
} else if (StringUtils.equals(id, app.getId())) {
return true;
} else if (properties == null || app.getProperties() == null) {
return false;
} else {
return StringUtils.equals(properties.get(CONTENT_ID_PROP_NAME),
app.getProperties().get(CONTENT_ID_PROP_NAME));
}
}

@Override
public int hashCode() {
return Objects.hash(properties == null ? id :
StringUtils.firstNonBlank(properties.get(CONTENT_ID_PROP_NAME), id));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.social.navigation.model;

import java.util.ArrayList;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TopbarConfiguration implements Cloneable {

private boolean displayCompanyName;

private boolean displaySiteName;

private boolean displayMobileCompanyLogo;

private List<TopbarApplication> applications;

@Override
public TopbarConfiguration clone() { // NOSONAR
return new TopbarConfiguration(displayCompanyName,
displaySiteName,
displayMobileCompanyLogo,
new ArrayList<>(applications));
}

}
Loading

0 comments on commit 8f6ab77

Please sign in to comment.