Skip to content

Commit

Permalink
feat: initial design with listing functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tegarimansyah committed Jun 25, 2023
1 parent 8f31ec4 commit 84d6257
Show file tree
Hide file tree
Showing 17 changed files with 624 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"printWidth": 120,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
Expand Down
44 changes: 16 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
# create-svelte
# Github Declutter

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
Declutter your unused repo. Create your github personal access token, give permission for these scopes:

## Creating a project
* repo
* gist
* delete_repo

If you're seeing this, you've probably already done this step. Congrats!
then declutter your repo.

```bash
# create a new project in the current directory
npm create svelte@latest
![docs/img/screenshot.png](docs/img/screenshot.png)

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev
## Deveelopment

# or start the server and open the app in a new browser tab
npm run dev -- --open
```sh
$ npm install
$ npm run dev -- --host
```

## Building

To create a production version of your app:

```bash
npm run build
```
## To Do

You can preview the production build with `npm run preview`.
* [ ] Actually delete the repo (currently just console log it)
* [ ] Implement Vuex for toggle and username+token
* [ ] Sort by
* [ ] Multiple deletion

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
Binary file added docs/img/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"autoprefixer": "^10.4.14",
"daisyui": "^3.1.6",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.30.0",
Expand All @@ -27,5 +28,9 @@
"typescript": "^5.0.0",
"vite": "^4.3.6"
},
"type": "module"
"type": "module",
"dependencies": {
"axios": "^1.4.0",
"clsx": "^1.2.1"
}
}
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
Expand Down
39 changes: 39 additions & 0 deletions src/lib/components/Auth.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script lang="ts">
import { userStore, patStore } from '$lib/utils/store';
import { github } from '$lib/utils/github';
import { AxiosError } from 'axios';
let pat = '';
async function fetchRepos() {
patStore.set(pat);
try {
const response = await github.get('/user');
userStore.set({ ...response.data, total_repos: 0 });
} catch (error) {
if (error instanceof AxiosError) {
if (error.response !== undefined) {
if (error.response.status === 401) {
alert('Your token is not valid');
} else {
alert(`Something went wrong: "${error.message}" with code ${error.response.status}`);
}
} else {
alert(`Something went wrong: ${error.message}`);
}
} else {
alert(error);
}
}
}
</script>

<form class="mt-10" on:submit|preventDefault={fetchRepos}>
<input
bind:value={pat}
type="password"
placeholder="Github Token"
class="input input-bordered border-gray-500 w-full max-w-xs mr-4"
/>
<button class="btn btn-outline" type="submit">Fetch Data</button>
</form>
Loading

1 comment on commit 84d6257

@vercel
Copy link

@vercel vercel bot commented on 84d6257 Jun 26, 2023

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.