Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Auto PR from dev* to main for h0lybyte

on:
pull_request:
push:
branches:
- 'dev*'
workflow_dispatch:

concurrency:
group: pr-auto-${{ github.head_ref }}
Expand All @@ -13,18 +14,12 @@ jobs:
auto-pr-to-main:
runs-on: ubuntu-latest
if: |
github.actor == 'h0lybyte'
github.repository == 'KBVE/waffle' && github.actor == 'h0lybyte'
steps:
- name: Check if user is a member of KBVE
id: org-check
run: |
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/orgs/KBVE/members/h0lybyte | grep 'login' || exit 1
- name: Checkout code
uses: actions/checkout@v4
- name: Create PR from dev* to main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --base main --head ${{ github.head_ref }} --title "Auto PR: ${{ github.head_ref }} to main" --body "Automated PR from dev* branch to main by workflow."
if: steps.org-check.outcome == 'success'
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [push, pull_request, workflow_dispatch]
on: [pull_request, workflow_dispatch]

name: CI

Expand Down
1 change: 1 addition & 0 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod uiux;
1 change: 1 addition & 0 deletions src/core/uiux/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod search;
41 changes: 41 additions & 0 deletions src/core/uiux/search.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use crate::db::github::Repository;
use crate::db::idb;
use egui::{Context, Id};

pub struct SearchWidget {
pub query: String,
pub results: Vec<Repository>,
pub loading: bool,
}

impl SearchWidget {
pub fn new() -> Self {
Self {
query: String::new(),
results: Vec::new(),
loading: false,
}
}

pub fn search(&mut self, language: &str, ctx: &Context) {
let query = self.query.clone();
let language = language.to_string();
let ctx = ctx.clone();
self.loading = true;
wasm_bindgen_futures::spawn_local(async move {
let result = match idb::open_waffle_db().await {
Ok(db_conn) => idb::filter_repos_in_idb::<Repository>(&db_conn, &language, &query).await.unwrap_or_default(),
Err(_) => vec![],
};
ctx.data_mut(|d| d.insert_temp(Id::new("waffle_search_results"), result));
ctx.request_repaint();
});
}

pub fn update_results_from_ctx(&mut self, ctx: &Context) {
if let Some(results) = ctx.data(|d| d.get_temp::<Vec<Repository>>(Id::new("waffle_search_results"))) {
self.results = results.clone();
self.loading = false;
}
}
}
1 change: 0 additions & 1 deletion src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod github;
pub use github::*;
pub mod idb;
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
fn main() {
use eframe::wasm_bindgen::JsCast as _;

// Redirect `log` message to `console.log` and friends:
eframe::WebLogger::init(log::LevelFilter::Debug).ok();

let web_options = eframe::WebOptions::default();
Expand Down
Loading