Skip to content

Commit

Permalink
Merge pull request #123 from cocola-dev/developer
Browse files Browse the repository at this point in the history
* Update New.tsx

* make comment section working

* Fix formatting issues in code

* Update Production_chacks.yml

* Bump vite from 5.1.2 to 5.2.8

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.2 to 5.2.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Create dependabot.yml

* Update package.json with new dependencies and fix formatting issues in code

* Update package-lock.json

* Bump vite in the npm_and_yarn group across 1 directory

Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 5.1.2 to 5.2.8
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <[email protected]>

* bug: fix broken link in email confirm (#122)

* bug: fix broken link in email confirm

* fix: change resources variable

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
ruru-m07 and dependabot[bot] authored May 1, 2024
2 parents b5fb4e9 + b9f6016 commit 1ee028e
Show file tree
Hide file tree
Showing 33 changed files with 2,592 additions and 1,909 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AUTH_SECRET=
RESEND_API_KEY=

# client url
NEXT_PUBLIC_VERCEL_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000

# your google gemini api key (optional).
GENERATIVE_API_KEY=
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "next/core-web-vitals"
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

2 changes: 2 additions & 0 deletions .github/workflows/Production_chacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- "*"
pull_request:
branches: ["*"]

jobs:
build:
Expand Down
72 changes: 36 additions & 36 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ name: "CodeQL"

on:
push:
branches: [ "*" ]
branches: ["*"]
pull_request:
branches: [ "*" ]
branches: ["*"]
schedule:
- cron: '38 17 * * 2'
- cron: "38 17 * * 2"

jobs:
analyze:
Expand All @@ -41,8 +41,8 @@ jobs:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
Expand All @@ -52,38 +52,38 @@ jobs:
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
8 changes: 4 additions & 4 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency review'
name: "Dependency review"
on:
pull_request:
branches: [ "*" ]
branches: ["*"]

# If using a dependency submission action in this workflow this permission will need to be set to:
#
Expand All @@ -27,9 +27,9 @@ jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
- name: "Checkout repository"
uses: actions/checkout@v4
- name: 'Dependency Review'
- name: "Dependency Review"
uses: actions/dependency-review-action@v4
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
with:
Expand Down
42 changes: 0 additions & 42 deletions .vscode/settings.json

This file was deleted.

34 changes: 34 additions & 0 deletions actions/repo/commments/fetchComments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"use server";

import { db } from "@/lib/db";
import { Comment } from "@prisma/client";

type FetchCommentsResult = {
success: boolean;
message?: string;
data?: Comment[];
};

export const fetchComments = async ({
repositoryPath,
issuePullRequestDiscussionId,
}: {
repositoryPath: string | null;
issuePullRequestDiscussionId: string | undefined;
}): Promise<FetchCommentsResult> => {
if (!repositoryPath || !issuePullRequestDiscussionId) {
return {
success: false,
message: "repositoryPath and issuePullRequestDiscussionId is req!",
};
}

const data = await db.comment.findMany({
where: {
repositoryPath: repositoryPath,
issuePullRequestDiscussionId: issuePullRequestDiscussionId,
},
});

return { success: true, data: data };
};
69 changes: 69 additions & 0 deletions actions/repo/issue/createComment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"use server";

import { db } from "@/lib/db";
import { Comment } from "@prisma/client";

export const createComment = async ({
repositoryPath,
body,
user,
IssuePullRequestId,
}: {
repositoryPath: string | null;
body: string | null;
user: string | undefined;
IssuePullRequestId: string | undefined;
}) => {
if (!repositoryPath || !user || !IssuePullRequestId) {
return { data: null, success: false };
}

if (!body) {
return { data: null, success: false, Message: "Body is required" };
}

// find last comment number

const latestComment = await db.comment.findFirst({
where: {
repositoryPath: repositoryPath,
},
orderBy: {
number: "desc",
},
});

// ! DEBUG: [X] console.log("latestComment", latestComment);

// crete new comment with body author number issuePullRequestDiscussionId

const nextIssueNumber: number = latestComment ? latestComment.number + 1 : 1;

// ! DEBUG: [X] console.log("nextIssueNumber", nextIssueNumber)

const comment: Comment = await db.comment.create({
data: {
body: body,
author: user,
repositoryPath: repositoryPath,
number: nextIssueNumber,
issuePullRequestDiscussionId: IssuePullRequestId,
},
});

// find issuePullRed and update commentscount to + 1

await db.issuePullRequest.update({
where: {
id: IssuePullRequestId,
repositoryPath: repositoryPath,
},
data: {
commentscount: {
increment: 1,
},
},
});

return { data: comment, success: true };
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions actions/repo/rendomRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import { db } from "@/lib/db";

export const ReandomRepos = async (
limit: number,
) => {
export const ReandomRepos = async (limit: number) => {
const ReandomRepo = await db.repository.findMany({
take: limit,
where: {
Expand Down
9 changes: 6 additions & 3 deletions app/[username]/[repository]/components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import { findBlobByName } from "@/hooks/Find-README-file";
import { FetchBlob } from "@/actions/repo/fetchBlob";
import { debounce } from "lodash";
import MarkdownReader from "@/components/mdx-components";
import ContentLoader from "@/components/ContentLoader";

export type FileItem = {
id: string;
Expand Down Expand Up @@ -121,7 +122,7 @@ export function Code({ repodata }: { repodata: Repository }) {
const [md, setMd] = React.useState<string>("");
const [mdload, setMdload] = React.useState<boolean>(false);
const [fetchingdataloadfortree, setFetchingdataloadfortree] =
React.useState<boolean>(false);
React.useState<boolean>(true);

// ! hooks
const user = useCurrentUser();
Expand Down Expand Up @@ -149,10 +150,12 @@ export function Code({ repodata }: { repodata: Repository }) {
console.log(READMEdata);
setMd(READMEdata.data);
}
setFetchingdataloadfortree(false);
})
.finally(() => {
setFetchingdataloadfortree(false);
});
setFetchingdataloadfortree(false);
}, 100);

React.useEffect(() => {
Expand Down Expand Up @@ -630,9 +633,9 @@ export function Code({ repodata }: { repodata: Repository }) {
<TableRow>
<TableCell
colSpan={columns.length}
className="h-24 overflow-hidden text-center"
className="h-24 overflow-hidden flex justify-center mt-4 text-center"
>
<Loader2 className="w-full animate-spin" />
<ContentLoader />
</TableCell>
</TableRow>
)}
Expand Down
Loading

1 comment on commit 1ee028e

@vercel
Copy link

@vercel vercel bot commented on 1ee028e May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.