-
-
Notifications
You must be signed in to change notification settings - Fork 97
Fix(GUI) Stretched Logo on Mobile and Safari #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
nitro56565
wants to merge
10
commits into
accordproject:main
from
nitro56565:nitro56565/i84/safari-header-logo-bug
Closed
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0c7f931
safari-logo-fix
nitro56565 d9258e5
error match & monaco model typo fix
nitro56565 e767ccf
matched concerto editor code with latest pr
nitro56565 3f6c22e
changed unit from em to px
nitro56565 199e28d
feat: generate shareable links implementation, lz-string compression …
Vinyl-Davyl f86c3e1
safari-logo-fix
nitro56565 56ff1dd
error match & monaco model typo fix
nitro56565 31b65eb
matched concerto editor code with latest pr
nitro56565 af8799f
changed unit from em to px
nitro56565 fbcb79b
Merge branch 'nitro56565/i84/safari-header-logo-bug' of https://githu…
nitro56565 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,157 @@ | ||
import * as monaco from '@monaco-editor/react'; | ||
import { editor, MarkerSeverity } from 'monaco-editor'; | ||
import useAppStore from './store'; | ||
import { useEffect, useMemo } from 'react'; | ||
import * as monaco from "@monaco-editor/react"; | ||
import { editor, MarkerSeverity } from "monaco-editor"; | ||
import useAppStore from "./store"; | ||
import { useEffect, useMemo } from "react"; | ||
|
||
const options:editor.IStandaloneEditorConstructionOptions = { | ||
const options: editor.IStandaloneEditorConstructionOptions = { | ||
minimap: { enabled: false }, | ||
wordWrap: "on", | ||
automaticLayout:true, | ||
automaticLayout: true, | ||
scrollBeyondLastLine: false, | ||
} | ||
const concertoKeywords = ['map','concept','from','optional','default','range','regex','length','abstract','namespace','import', 'enum', 'scalar', 'extends', 'default', 'participant','asset', 'o','identified by','transaction','event']; | ||
const concertoTypes = ['String','Integer','Double','DateTime','Long','Boolean'] | ||
}; | ||
|
||
export default function ConcertoEditor( {value, onChange} : {value: string, onChange?: (value:string|undefined) => void} ) { | ||
const concertoKeywords = [ | ||
"map", | ||
"concept", | ||
"from", | ||
"optional", | ||
"default", | ||
"range", | ||
"regex", | ||
"length", | ||
"abstract", | ||
"namespace", | ||
"import", | ||
"enum", | ||
"scalar", | ||
"extends", | ||
"default", | ||
"participant", | ||
"asset", | ||
"o", | ||
"identified by", | ||
"transaction", | ||
"event", | ||
]; | ||
|
||
const monacoEditor = monaco.useMonaco(); | ||
const error = useAppStore((state) => state.error); | ||
const ctoErr = useMemo(() => { | ||
if (error && error.startsWith("c:")) { | ||
return error; | ||
} | ||
}, [error]); | ||
useEffect(() => { | ||
let model = monacoEditor?.editor.getModels()[0]; | ||
if (ctoErr && monacoEditor) { | ||
const match = ctoErr.match(/Line (\d+) column (\d+)/); | ||
const concertoTypes = [ | ||
"String", | ||
"Integer", | ||
"Double", | ||
"DateTime", | ||
"Long", | ||
"Boolean", | ||
]; | ||
|
||
const lineNumber = parseInt(match[1]); | ||
const columnNumber = parseInt(match[2]) ; | ||
monacoEditor?.editor.setModelMarkers(model, "customMarker", [ | ||
{ | ||
export default function ConcertoEditor({ | ||
value, | ||
onChange, | ||
}: { | ||
value: string; | ||
onChange?: (value: string | undefined) => void; | ||
}) { | ||
const monacoEditor = monaco.useMonaco(); | ||
const error = useAppStore((state) => state.error); | ||
const ctoErr = useMemo(() => { | ||
if (error && error.startsWith("c:")) { | ||
return error; | ||
} | ||
}, [error]); | ||
|
||
useEffect(() => { | ||
const model = monacoEditor?.editor.getModels()[0]; | ||
if (ctoErr && monacoEditor && model) { | ||
const match = ctoErr.match(/Line (\d+) column (\d+)/); | ||
if (match) { | ||
const lineNumber = parseInt(match[1], 10); | ||
const columnNumber = parseInt(match[2], 10); | ||
monacoEditor.editor.setModelMarkers(model, "customMarker", [ | ||
{ | ||
startLineNumber: lineNumber, | ||
startColumn: columnNumber - 1, | ||
endLineNumber: lineNumber, | ||
endColumn: columnNumber + 1, | ||
message: ctoErr, | ||
severity: MarkerSeverity.Error, | ||
}, | ||
}, | ||
]); | ||
} else { | ||
monacoEditor?.editor.setModelMarkers(model, "customMarker", []); | ||
} | ||
}, [ctoErr,monacoEditor]); | ||
function handleEditorWillMount(monaco:monaco.Monaco) { | ||
monaco.languages.register({ | ||
id: 'concerto', | ||
extensions: ['.cto'], | ||
aliases: ['Concerto', 'concerto'], | ||
mimetypes: ['application/vnd.accordproject.concerto'], | ||
}); | ||
|
||
monaco.languages.setMonarchTokensProvider('concerto', { | ||
keywords: concertoKeywords, | ||
typeKeywords: concertoTypes, | ||
operators: ['=', '{', '}', '@', '"'], | ||
symbols: /[=}{@"]+/, | ||
escapes: /\\(?:[btnfru"'\\]|\\u[0-9A-Fa-f]{4})/, | ||
tokenizer: { | ||
root: [ | ||
{ include: '@whitespace' }, | ||
[/[a-zA-Z_]\w*/, { | ||
cases: { | ||
'@keywords': 'keyword', | ||
'@typeKeywords': 'type', | ||
'@default': 'identifier', | ||
}, | ||
}], | ||
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-terminated string | ||
[/"/, 'string', '@string'], | ||
], | ||
string: [ | ||
[/[^\\"]+/, 'string'], | ||
[/@escapes/, 'string.escape'], | ||
[/\\./, 'string.escape.invalid'], | ||
[/"/, 'string', '@pop'], | ||
], | ||
whitespace: [ | ||
[/\s+/, 'white'], | ||
[/(\/\/.*)/, 'comment'], | ||
], | ||
}, | ||
}); | ||
monaco.editor.defineTheme('concertoTheme', { | ||
base: 'vs', | ||
inherit: true, | ||
rules: [ | ||
{ token: 'keyword', foreground: 'cd2184' }, | ||
{ token: 'type', foreground: '008080' }, | ||
{ token: 'identifier', foreground: '000000' }, | ||
{ token: 'string', foreground: '008000' }, | ||
{ token: 'string.escape', foreground: '800000' }, | ||
{ token: 'comment', foreground: '808080' }, | ||
{ token: 'white', foreground: 'FFFFFF' }, | ||
], | ||
colors: {}, | ||
}); | ||
|
||
monaco.editor.setTheme('concertoTheme'); | ||
} | ||
} else if (monacoEditor && model) { | ||
monacoEditor.editor.setModelMarkers(model, "customMarker", []); | ||
} | ||
|
||
return ( | ||
}, [ctoErr, monacoEditor]); | ||
|
||
function handleEditorWillMount(monaco: monaco.Monaco) { | ||
monaco.languages.register({ | ||
id: "concerto", | ||
extensions: [".cto"], | ||
aliases: ["Concerto", "concerto"], | ||
mimetypes: ["application/vnd.accordproject.concerto"], | ||
}); | ||
|
||
monaco.languages.setMonarchTokensProvider("concerto", { | ||
keywords: concertoKeywords, | ||
typeKeywords: concertoTypes, | ||
operators: ["=", "{", "}", "@", '"'], | ||
symbols: /[=}{@"]+/, | ||
escapes: /\\(?:[btnfru"'\\]|\\u[0-9A-Fa-f]{4})/, | ||
tokenizer: { | ||
root: [ | ||
{ include: "@whitespace" }, | ||
[ | ||
/[a-zA-Z_]\w*/, | ||
{ | ||
cases: { | ||
"@keywords": "keyword", | ||
"@typeKeywords": "type", | ||
"@default": "identifier", | ||
}, | ||
}, | ||
], | ||
[/"([^"\\]|\\.)*$/, "string.invalid"], // non-terminated string | ||
[/"/, "string", "@string"], | ||
], | ||
string: [ | ||
[/[^\\"]+/, "string"], | ||
[/@escapes/, "string.escape"], | ||
[/\\./, "string.escape.invalid"], | ||
[/"/, "string", "@pop"], | ||
], | ||
whitespace: [ | ||
[/\s+/, "white"], | ||
[/(\/\/.*)/, "comment"], | ||
], | ||
}, | ||
}); | ||
|
||
monaco.editor.defineTheme("concertoTheme", { | ||
base: "vs", | ||
inherit: true, | ||
rules: [ | ||
{ token: "keyword", foreground: "cd2184" }, | ||
{ token: "type", foreground: "008080" }, | ||
{ token: "identifier", foreground: "000000" }, | ||
{ token: "string", foreground: "008000" }, | ||
{ token: "string.escape", foreground: "800000" }, | ||
{ token: "comment", foreground: "808080" }, | ||
{ token: "white", foreground: "FFFFFF" }, | ||
], | ||
colors: {}, | ||
}); | ||
|
||
monaco.editor.setTheme("concertoTheme"); | ||
} | ||
|
||
return ( | ||
<div className="editorwrapper"> | ||
<monaco.Editor options={ options } | ||
language='concerto' height="60vh" value={value} onChange={onChange} beforeMount={handleEditorWillMount}/> | ||
<monaco.Editor | ||
options={options} | ||
language="concerto" | ||
height="60vh" | ||
value={value} | ||
onChange={onChange} | ||
beforeMount={handleEditorWillMount} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ function Navbar({ scrollToExplore }: { scrollToExplore: any }) { | |
preview={false} | ||
style={{ | ||
paddingRight: screens.md ? "1.5em" : "10px", | ||
height: "26px", | ||
height: "26px", maxWidth: screens.md ? '184.17px' : '36.67px', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine for now. @Vinyl-Davyl @nitro56565 can we please look into having a consistent unit for styles, we are using em, px both. Let's please fix this as well. |
||
}} | ||
/> | ||
<span style={{ color: "white" }}>Template Playground</span> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay @nitro56565 can you change this: 1.5em in the paddingRight, to the equivalent of 24 pixels from the base format 16px.
so change 1.5em to 24px to ensure consistency here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright I'll do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vinyl-Davyl done with these changes