Skip to content

Commit

Permalink
Merge pull request #68 from intechstudio/feat/Configuration
Browse files Browse the repository at this point in the history
🚩PR: Added Configuration.JSON
  • Loading branch information
elsoazemelet authored Apr 19, 2024
2 parents 90bcd90 + 4f3d798 commit 162fe6a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
8 changes: 8 additions & 0 deletions Configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"RECOMMENDED_CONFIG_PROFILE_IDS": [
"7ZOAy8UmSGTsNeQcKmNLMUgfEbW2",
"12gUq1wXjDVkLH9pDUbN2RzCoos1",
"RDoRUL39LEe9R81BSEJqwj52n0v1"
],
"DEEPLINK_PROTOCOL_NAME": "grid-editor"
}
5 changes: 4 additions & 1 deletion src/routes/BrowserLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Filter from "./Filter.svelte";
import { type ConfigManager, createConfigManager } from "$lib/configmanager/ConfigManager";
import ConfigCardBrowser from "./ConfigCardBrowser.svelte";
import configuration from "../../Configuration.json";
let selectedConfigIndex: number | undefined = undefined;
Expand Down Expand Up @@ -76,7 +77,9 @@
<svelte:fragment slot="import-config-browser-button">
<button
on:click={() => {
const configLinkUrl = "grid-editor://?config-link=" + config.id;
const configLinkUrl =
`${configuration.DEEPLINK_PROTOCOL_NAME}://?config-link=` +
config.id;
window.open(configLinkUrl, "_self");
}}
class="rounded px-4 py-1 dark:bg-emerald-600 dark:hover:bg-emerald-700 font-medium"
Expand Down
21 changes: 10 additions & 11 deletions src/routes/EditorLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import { Pane, Splitpanes } from "svelte-splitpanes";
import Accordion from "$lib/components/accordion/Accordion.svelte";
import AccordionItem from "$lib/components/accordion/AccordionItem.svelte";
import configuration from "../../Configuration.json";
let selectedConfigId: string | undefined = undefined;
let selectedConfigIndex: number;
Expand Down Expand Up @@ -195,7 +196,8 @@
});
return;
}
const configLinkUrl = "grid-editor://?config-link=" + configCloudId;
const configLinkUrl =
`${configuration.DEEPLINK_PROTOCOL_NAME}://?config-link=` + configCloudId;
await parentIframeCommunication({
windowPostMessageName: "createCloudConfigLink",
Expand Down Expand Up @@ -229,11 +231,9 @@
function getConfigCategory(config: any): string {
var isMyConfig =
config.syncStatus == "local" || config.owner === configManager?.getCurrentOwnerId();
var isOfficialConfig = [
"7ZOAy8UmSGTsNeQcKmNLMUgfEbW2",
"12gUq1wXjDVkLH9pDUbN2RzCoos1",
"RDoRUL39LEe9R81BSEJqwj52n0v1"
].includes(config.owner ?? "");
var isOfficialConfig = configuration.RECOMMENDED_CONFIG_PROFILE_IDS.includes(
config.owner ?? ""
);
if (isMyConfig) {
return "my_configs";
Expand Down Expand Up @@ -366,11 +366,10 @@
var isMyConfig =
e.syncStatus == "local" ||
e.owner === configManager?.getCurrentOwnerId();
var isOfficialConfig = [
"7ZOAy8UmSGTsNeQcKmNLMUgfEbW2",
"12gUq1wXjDVkLH9pDUbN2RzCoos1",
"RDoRUL39LEe9R81BSEJqwj52n0v1"
].includes(e.owner ?? "");
var isOfficialConfig =
configuration.RECOMMENDED_CONFIG_PROFILE_IDS.includes(
e.owner ?? ""
);
switch (configType) {
case "my_configs":
return isMyConfig;
Expand Down
3 changes: 2 additions & 1 deletion src/routes/authorize/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import GoogleAuth from "$lib/components/GoogleAuth.svelte";
import configuration from "../../../Configuration.json";
type AuthStatus = {
status: number;
Expand Down Expand Up @@ -28,7 +29,7 @@
let showCloseBrowserNotification = false;
function buildProtocolUrl(credential: string) {
return "grid-editor://?credential=" + credential;
return `${configuration.DEEPLINK_PROTOCOL_NAME}://?credential=` + credential;
}
function handleCredentialResponse(event: CustomEvent) {
Expand Down

0 comments on commit 162fe6a

Please sign in to comment.