-
Notifications
You must be signed in to change notification settings - Fork 1
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
Liuliu/electron app #1
Conversation
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.
Overall looks good. A few questions/clarifications
package.json
Outdated
"clean": "tsc -b --clean && yarn yalc:clean", | ||
"compile": "tsc -b" |
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.
Should these use the clean
and compile
scripts from the workspaces instead? Like we do in ld/web
schema.gql
Outdated
@@ -0,0 +1,376 @@ | |||
# ------------------------------------------------------ |
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.
Doesn't seem like this file belongs here? Isn't this already in graphql-server
?
web/contexts/serverConfig.tsx
Outdated
function useServerConfigIPC(): { | ||
data: ServerConfigContextValue | undefined; | ||
error: any; | ||
} { |
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.
Can you move this return type to a declared type? Can also use the type for InnerProps
since they share data
and error
return process.env.NEXT_PUBLIC_FOR_ELECTRON === "true" ? ( | ||
<IPCConfigProvider>{children}</IPCConfigProvider> | ||
) : ( | ||
<APIConfigProvider>{children}</APIConfigProvider> | ||
); |
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.
Could use a comment here for what this does/why
web/hooks/useUserHeaders.ts
Outdated
const fetchHeaders = async () => { | ||
const response = await fetch("/api/headers"); // This endpoint should return headers | ||
const headersData = await response.json(); | ||
const user = headersData["x-forwarded-user"]; | ||
const email = headersData["x-forwarded-email"]; | ||
if (user || email) { | ||
setHeaders({ user, email }); | ||
} | ||
}; | ||
|
||
await fetchHeaders(); |
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.
Was there a reason you changed this?
web/next.config.js
Outdated
loader: 'webpack-preprocessor-loader', | ||
options: { | ||
params: { | ||
isWeb: process.env.NEXT_PUBLIC_FOR_ELECTRON!=="true", |
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.
isWeb
isn't the clearest name. Maybe isElectron
and do #!if !isElectron
in the pages?
isWeb: process.env.NEXT_PUBLIC_FOR_ELECTRON!=="true", | |
isElectron: process.env.NEXT_PUBLIC_FOR_ELECTRON === "true", |
test: /\.tsx$/, | ||
use: [ | ||
{ | ||
loader: 'webpack-preprocessor-loader', |
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.
This could also use a comment for its purpose
@@ -5,14 +5,14 @@ import { GetServerSideProps, NextPage } from "next"; | |||
|
|||
type Params = RefParams & { | |||
diffRange: string; | |||
tableName?: string; |
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.
I wouldn't expect there to be any params/props changes in this PR? Where are all of these coming from?
web/postcss.config.js
Outdated
module.exports = { | ||
plugins: { | ||
"tailwindcss/nesting": {}, | ||
tailwindcss: {}, | ||
tailwindcss: { ...tailwindConfig }, |
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.
What does this do?
web/tailwind.config.js
Outdated
@@ -0,0 +1,24 @@ | |||
const { mergeConfig } = require("@dolthub/react-components"); |
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.
Does this need to be .js
?
}} | ||
compare | ||
/> | ||
<DatabasePage.ForCommits params={params} compare /> |
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.
tableName
needs to be passed explicitly here
@@ -6,8 +6,8 @@ import { GetServerSideProps, NextPage } from "next"; | |||
type Props = { | |||
params: TableParams & { | |||
active?: string; | |||
edit?: boolean; |
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.
edit
needs to be explicitly passed to DatabasePage.ForTable
now that it isn't a prop
To run in dev mode: run
yarn dev
in the root directory.Changes:
add
package.json
in root directory, putweb
andgraphql-server
inworkspaces
.In
main
:background.ts
starts the main process, creates the app window and loads the built files.createGraphqlSeverProcess
executes a child process to spawn the GraphQL server.preload.ts
establishes the IPC handler for communication between the renderer and the main process.web
:pages
, commentedgetServerSideProps
because server side rendering is not allowed.serverConfig.tsx
, useipc
to get the api/config, sinceapi
route is not allowed in nextron build.graphql-server
:After the app is built, writing schema.gql file in the app is not allowed since the app is readonly. We will write the file to the user's application data folder specified by
process.env.SCHEMA_PATH
. This path is set inbackground.ts
as follows:const schemaPath = path.join(userDataPath, "schema.gql");
Existing issues:
Distributing the built macOS application have an issue due to the "com.apple.Quarantine" attribute applied when the app is not downloaded from an Apple-sanctioned source. A temporary workaround involves disabling Gatekeeper for the app with the command:
xattr -c <path/to/application.app>
A more permanent solution requires getting an Apple Developer account, a Team ID for our developer team, and add this ID into the build configuration: